@@ -100,6 +100,10 @@ where
100100 trace ! ( "SHOW VERSION" ) ;
101101 show_version ( stream) . await
102102 }
103+ "USERS" => {
104+ trace ! ( "SHOW USERS" ) ;
105+ show_users ( stream) . await
106+ }
103107 _ => error_response ( stream, "Unsupported SHOW query against the admin database" ) . await ,
104108 } ,
105109 _ => error_response ( stream, "Unsupported query against the admin database" ) . await ,
@@ -666,3 +670,32 @@ where
666670 }
667671 }
668672}
673+
674+ /// Show Users.
675+ async fn show_users < T > ( stream : & mut T ) -> Result < ( ) , Error >
676+ where
677+ T : tokio:: io:: AsyncWrite + std:: marker:: Unpin ,
678+ {
679+ let mut res = BytesMut :: new ( ) ;
680+
681+ res. put ( row_description ( & vec ! [
682+ ( "name" , DataType :: Text ) ,
683+ ( "pool_mode" , DataType :: Text ) ,
684+ ] ) ) ;
685+
686+ for ( user_pool, pool) in get_all_pools ( ) {
687+ let pool_config = & pool. settings ;
688+ res. put ( data_row ( & vec ! [
689+ user_pool. user. clone( ) ,
690+ pool_config. pool_mode. to_string( ) ,
691+ ] ) ) ;
692+ }
693+
694+ res. put ( command_complete ( "SHOW" ) ) ;
695+
696+ res. put_u8 ( b'Z' ) ;
697+ res. put_i32 ( 5 ) ;
698+ res. put_u8 ( b'I' ) ;
699+
700+ write_all_half ( stream, & res) . await
701+ }
0 commit comments