Struct sea_orm_migration::prelude::extension::postgres::TypeDropStatement
source · pub struct TypeDropStatement { /* private fields */ }
Implementations§
source§impl TypeDropStatement
impl TypeDropStatement
pub fn new() -> TypeDropStatement
sourcepub fn name<T>(&mut self, name: T) -> &mut TypeDropStatementwhere
T: IntoTypeRef,
pub fn name<T>(&mut self, name: T) -> &mut TypeDropStatementwhere
T: IntoTypeRef,
Drop a type
use sea_query::{extension::postgres::Type, *};
struct FontFamily;
impl Iden for FontFamily {
fn unquoted(&self, s: &mut dyn Write) {
write!(s, "{}", "font_family").unwrap();
}
}
assert_eq!(
Type::drop()
.if_exists()
.name(FontFamily)
.restrict()
.to_string(PostgresQueryBuilder),
r#"DROP TYPE IF EXISTS "font_family" RESTRICT"#
);
sourcepub fn names<T, I>(&mut self, names: I) -> &mut TypeDropStatementwhere
T: IntoTypeRef,
I: IntoIterator<Item = T>,
pub fn names<T, I>(&mut self, names: I) -> &mut TypeDropStatementwhere
T: IntoTypeRef,
I: IntoIterator<Item = T>,
Drop multiple types
use sea_query::{extension::postgres::Type, *};
#[derive(Iden)]
enum KycStatus {
#[iden = "kyc_status"]
Type,
Pending,
Approved,
}
#[derive(Iden)]
enum FontFamily {
#[iden = "font_family"]
Type,
Aerial,
Forte,
}
assert_eq!(
Type::drop()
.if_exists()
.names([
SeaRc::new(KycStatus::Type) as DynIden,
SeaRc::new(FontFamily::Type) as DynIden,
])
.cascade()
.to_string(PostgresQueryBuilder),
r#"DROP TYPE IF EXISTS "kyc_status", "font_family" CASCADE"#
);
sourcepub fn if_exists(&mut self) -> &mut TypeDropStatement
pub fn if_exists(&mut self) -> &mut TypeDropStatement
Set IF EXISTS
sourcepub fn cascade(&mut self) -> &mut TypeDropStatement
pub fn cascade(&mut self) -> &mut TypeDropStatement
Set CASCADE
sourcepub fn restrict(&mut self) -> &mut TypeDropStatement
pub fn restrict(&mut self) -> &mut TypeDropStatement
Set RESTRICT
source§impl TypeDropStatement
impl TypeDropStatement
pub fn build_ref<T>(&self, type_builder: &T) -> Stringwhere
T: TypeBuilder,
pub fn build_collect<T>(
&self,
type_builder: T,
sql: &mut dyn SqlWriter
) -> Stringwhere
T: TypeBuilder,
pub fn build_collect_ref<T>(
&self,
type_builder: &T,
sql: &mut dyn SqlWriter
) -> Stringwhere
T: TypeBuilder,
sourcepub fn to_string<T>(&self, type_builder: T) -> Stringwhere
T: TypeBuilder + QueryBuilder,
pub fn to_string<T>(&self, type_builder: T) -> Stringwhere
T: TypeBuilder + QueryBuilder,
Build corresponding SQL statement and return SQL string
Trait Implementations§
source§impl Clone for TypeDropStatement
impl Clone for TypeDropStatement
source§fn clone(&self) -> TypeDropStatement
fn clone(&self) -> TypeDropStatement
Returns a copy 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 TypeDropStatement
impl Debug for TypeDropStatement
source§impl Default for TypeDropStatement
impl Default for TypeDropStatement
source§fn default() -> TypeDropStatement
fn default() -> TypeDropStatement
Returns the “default value” for a type. Read more
source§impl StatementBuilder for TypeDropStatement
impl StatementBuilder for TypeDropStatement
Auto Trait Implementations§
impl Freeze for TypeDropStatement
impl !RefUnwindSafe for TypeDropStatement
impl Send for TypeDropStatement
impl Sync for TypeDropStatement
impl Unpin for TypeDropStatement
impl !UnwindSafe for TypeDropStatement
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