risingwave_frontend/catalog/system_catalog/rw_catalog/
rw_users.rs1use risingwave_common::types::Fields;
16use risingwave_frontend_macro::system_catalog;
17
18use crate::catalog::system_catalog::SysCatalogReaderImpl;
19use crate::error::Result;
20
21#[derive(Fields)]
22struct RwUser {
23 #[primary_key]
24 id: i32,
25 name: String,
26 is_super: bool,
27 create_db: bool,
28 create_user: bool,
29 can_login: bool,
30}
31
32#[system_catalog(table, "rw_catalog.rw_users")]
33fn read_rw_user_info(reader: &SysCatalogReaderImpl) -> Result<Vec<RwUser>> {
34 let reader = reader.user_info_reader.read_guard();
35 let users = reader.get_all_users();
36
37 Ok(users
38 .into_iter()
39 .map(|user| RwUser {
40 id: user.id as i32,
41 name: user.name,
42 is_super: user.is_super,
43 create_db: user.can_create_db,
44 create_user: user.can_create_user,
45 can_login: user.can_login,
46 })
47 .collect())
48}