/// Generate role database to SQL.
///
/// ```sql
/// { GRANT | REVOKE } { { CREATE | TEMPORARY | TEMP } [,...] | ALL [ PRIVILEGES ] }
/// ON DATABASE db_name [, ...]
/// TO { username [ WITH GRANT OPTION ] | GROUP group_name | PUBLIC } [, ...]
/// ```
Generate role database to SQL.
Generate role database to SQL .
pub fn to_sql(&self, user: &str) -> String {
        // grant all if no grants specified or contains "ALL"
        let grants = if self.grants.is_empty() || self.grants.contains(&"ALL".to_string()) {
            "ALL PRIVILEGES".to_string()
        } else {
            self.grants.join(", ")
        };
        // grant on databases to user
        let sql = format!(
            "GRANT {} ON DATABASE {} TO {};",
            grants,
            self.databases.join(", "),
            user
        );
        sql
    }
pub fn to_sql ( & self , user : & str ) -> String { // grant all if no grants specified or contains "ALL" let grants = if self . grants . is_empty ( ) || self . grants . contains ( & " " . to_string ( ) ) { " " . to_string ( ) } else { self . grants . join ( " " ) } ; // grant on databases to user let sql = format ! ( " " grants self databases join ( " " ) user ) ; sql }
Generate role database to SQL.
Generate role database to SQL .
&self
user
&str