pub struct Role {
pub name: String,
pub password: Option<String>,
pub superuser: bool,
pub createdb: bool,
pub createrole: bool,
pub inherit: bool,
pub login: bool,
pub replication: bool,
pub connection_limit: Option<i32>,
pub valid_until: Option<String>,
pub member_of: Vec<String>,
pub members: Vec<String>,
}Expand description
PostgreSQL role representation
Fields§
§name: String§password: Option<String>§superuser: bool§createdb: bool§createrole: bool§inherit: bool§login: bool§replication: bool§connection_limit: Option<i32>§valid_until: Option<String>§member_of: Vec<String>§members: Vec<String>Implementations§
Source§impl Role
impl Role
Sourcepub fn with_password(self, password: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<String>) -> Self
Set password
Sourcepub fn with_superuser(self, superuser: bool) -> Self
pub fn with_superuser(self, superuser: bool) -> Self
Set superuser privileges
Sourcepub fn with_createdb(self, createdb: bool) -> Self
pub fn with_createdb(self, createdb: bool) -> Self
Set database creation privileges
Sourcepub fn with_createrole(self, createrole: bool) -> Self
pub fn with_createrole(self, createrole: bool) -> Self
Set role creation privileges
Sourcepub fn with_inherit(self, inherit: bool) -> Self
pub fn with_inherit(self, inherit: bool) -> Self
Set inheritance behavior
Sourcepub fn with_login(self, login: bool) -> Self
pub fn with_login(self, login: bool) -> Self
Set login capability
Sourcepub fn with_replication(self, replication: bool) -> Self
pub fn with_replication(self, replication: bool) -> Self
Set replication privileges
Sourcepub fn with_connection_limit(self, limit: i32) -> Self
pub fn with_connection_limit(self, limit: i32) -> Self
Set connection limit
Sourcepub fn with_valid_until(self, until: impl Into<String>) -> Self
pub fn with_valid_until(self, until: impl Into<String>) -> Self
Set validity period
Sourcepub fn with_member_of(self, roles: Vec<String>) -> Self
pub fn with_member_of(self, roles: Vec<String>) -> Self
Add parent roles (inheritance)
Sourcepub fn with_members(self, members: Vec<String>) -> Self
pub fn with_members(self, members: Vec<String>) -> Self
Add member roles
Sourcepub fn generate_create_ddl(&self) -> String
pub fn generate_create_ddl(&self) -> String
Generate CREATE ROLE DDL
Sourcepub fn generate_alter_ddl(&self, old_role: &Role) -> String
pub fn generate_alter_ddl(&self, old_role: &Role) -> String
Generate ALTER ROLE DDL for modifications
Sourcepub fn generate_drop_ddl(&self) -> String
pub fn generate_drop_ddl(&self) -> String
Generate DROP ROLE DDL
Trait Implementations§
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 UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more