pub struct Role {
pub name: String,
pub login: bool,
pub password: Option<String>,
pub inherit_from: Vec<String>,
pub superuser: bool,
pub createdb: bool,
pub createrole: bool,
pub connection_limit: Option<i32>,
pub valid_until: Option<String>,
}Expand description
A database role definition.
Fields§
§name: StringRole name.
login: boolWhether this role can login.
password: Option<String>Password (if login enabled).
inherit_from: Vec<String>Roles this role inherits from.
superuser: boolWhether this is a superuser.
createdb: boolWhether this role can create databases.
createrole: boolWhether this role can create other roles.
connection_limit: Option<i32>Connection limit.
valid_until: Option<String>Valid until timestamp.
Implementations§
Source§impl Role
impl Role
Sourcepub fn new(name: impl Into<String>) -> RoleBuilder
pub fn new(name: impl Into<String>) -> RoleBuilder
Create a new role.
Sourcepub fn to_postgres_sql(&self) -> String
pub fn to_postgres_sql(&self) -> String
Generate PostgreSQL CREATE ROLE SQL.
Sourcepub fn to_mysql_sql(&self) -> Vec<String>
pub fn to_mysql_sql(&self) -> Vec<String>
Generate MySQL CREATE USER/ROLE SQL.
Sourcepub fn to_mssql_sql(&self, database: &str) -> Vec<String>
pub fn to_mssql_sql(&self, database: &str) -> Vec<String>
Generate MSSQL CREATE LOGIN/USER SQL.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Role
impl<'de> Deserialize<'de> for Role
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Role
impl StructuralPartialEq for Role
Auto Trait Implementations§
impl Freeze for Role
impl RefUnwindSafe for Role
impl Send for Role
impl Sync for Role
impl Unpin for Role
impl UnwindSafe for Role
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more