pub struct DropRoleStatement {
pub role_names: Vec<String>,
pub if_exists: bool,
}Expand description
DROP ROLE statement builder
§Examples
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new()
.roles(vec!["user1".to_string(), "user2".to_string()])
.if_exists(true);Fields§
§role_names: Vec<String>Role names to drop
if_exists: boolIF EXISTS clause
Implementations§
Source§impl DropRoleStatement
impl DropRoleStatement
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new empty DROP ROLE statement
§Examples
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new();Sourcepub fn role(self, name: impl Into<String>) -> Self
pub fn role(self, name: impl Into<String>) -> Self
Add a single role name to drop
§Examples
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new()
.role("app_user");Sourcepub fn roles(self, names: Vec<String>) -> Self
pub fn roles(self, names: Vec<String>) -> Self
Set all role names to drop at once
§Examples
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new()
.roles(vec!["user1".to_string(), "user2".to_string()]);Sourcepub fn if_exists(self, flag: bool) -> Self
pub fn if_exists(self, flag: bool) -> Self
Set the IF EXISTS flag
§Examples
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new()
.role("app_user")
.if_exists(true);Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validate the DROP ROLE statement
§Validation Rules
- At least one role name is required
§Examples
Valid statement:
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new()
.role("app_user");
assert!(stmt.validate().is_ok());Invalid statement (no role names):
use reinhardt_query::dcl::DropRoleStatement;
let stmt = DropRoleStatement::new();
assert!(stmt.validate().is_err());Trait Implementations§
Source§impl Clone for DropRoleStatement
impl Clone for DropRoleStatement
Source§fn clone(&self) -> DropRoleStatement
fn clone(&self) -> DropRoleStatement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DropRoleStatement
impl Debug for DropRoleStatement
Source§impl Default for DropRoleStatement
impl Default for DropRoleStatement
Source§fn default() -> DropRoleStatement
fn default() -> DropRoleStatement
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for DropRoleStatement
impl RefUnwindSafe for DropRoleStatement
impl Send for DropRoleStatement
impl Sync for DropRoleStatement
impl Unpin for DropRoleStatement
impl UnsafeUnpin for DropRoleStatement
impl UnwindSafe for DropRoleStatement
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