pub struct RoleDef {
pub name: &'static str,
pub superuser: Option<bool>,
pub create_db: Option<bool>,
pub create_role: Option<bool>,
pub inherit: Option<bool>,
pub can_login: Option<bool>,
pub replication: Option<bool>,
pub bypass_rls: Option<bool>,
pub conn_limit: Option<i32>,
pub password: Option<&'static str>,
pub valid_until: Option<&'static str>,
}Available on crate feature
std only.Expand description
Const-friendly role definition for compile-time schema definitions.
Fields§
§name: &'static strRole name
superuser: Option<bool>Superuser privilege
create_db: Option<bool>Can create databases?
create_role: Option<bool>Can create roles?
inherit: Option<bool>Inherit privileges?
can_login: Option<bool>Can login?
replication: Option<bool>Replication privilege
bypass_rls: Option<bool>Bypass row-level security
conn_limit: Option<i32>Connection limit (-1 for unlimited)
password: Option<&'static str>Password (encrypted)
valid_until: Option<&'static str>Password expiration date
Implementations§
Source§impl RoleDef
impl RoleDef
Sourcepub const fn new(name: &'static str) -> RoleDef
Available on crate features alloc or std only.
pub const fn new(name: &'static str) -> RoleDef
alloc or std only.Create a new role definition
Sourcepub const fn superuser(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn superuser(self, value: bool) -> RoleDef
alloc or std only.Set superuser privilege
Sourcepub const fn create_db(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn create_db(self, value: bool) -> RoleDef
alloc or std only.Set create_db flag
Sourcepub const fn create_role(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn create_role(self, value: bool) -> RoleDef
alloc or std only.Set create_role flag
Sourcepub const fn inherit(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn inherit(self, value: bool) -> RoleDef
alloc or std only.Set inherit flag
Sourcepub const fn can_login(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn can_login(self, value: bool) -> RoleDef
alloc or std only.Set can_login flag
Sourcepub const fn replication(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn replication(self, value: bool) -> RoleDef
alloc or std only.Set replication privilege
Sourcepub const fn bypass_rls(self, value: bool) -> RoleDef
Available on crate features alloc or std only.
pub const fn bypass_rls(self, value: bool) -> RoleDef
alloc or std only.Set bypass_rls flag
Sourcepub const fn conn_limit(self, limit: i32) -> RoleDef
Available on crate features alloc or std only.
pub const fn conn_limit(self, limit: i32) -> RoleDef
alloc or std only.Set connection limit
Sourcepub const fn password(self, password: &'static str) -> RoleDef
Available on crate features alloc or std only.
pub const fn password(self, password: &'static str) -> RoleDef
alloc or std only.Set password
Sourcepub const fn valid_until(self, date: &'static str) -> RoleDef
Available on crate features alloc or std only.
pub const fn valid_until(self, date: &'static str) -> RoleDef
alloc or std only.Set valid_until date
Trait Implementations§
impl Copy for RoleDef
impl Eq for RoleDef
impl StructuralPartialEq for RoleDef
Auto Trait Implementations§
impl Freeze for RoleDef
impl RefUnwindSafe for RoleDef
impl Send for RoleDef
impl Sync for RoleDef
impl Unpin for RoleDef
impl UnsafeUnpin for RoleDef
impl UnwindSafe for RoleDef
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