pub struct TypeCreateStatement { /* private fields */ }
Available on crate feature
backend-postgres
only.Implementations§
source§impl TypeCreateStatement
impl TypeCreateStatement
pub fn new() -> Self
sourcepub fn as_enum<T>(&mut self, name: T) -> &mut Selfwhere
T: IntoTypeRef,
pub fn as_enum<T>(&mut self, name: T) -> &mut Selfwhere
T: IntoTypeRef,
Create enum as custom type
use sea_query::{extension::postgres::Type, *};
enum FontFamily {
Type,
Serif,
Sans,
Monospace,
}
impl Iden for FontFamily {
fn unquoted(&self, s: &mut dyn Write) {
write!(
s,
"{}",
match self {
Self::Type => "font_family",
Self::Serif => "serif",
Self::Sans => "sans",
Self::Monospace => "monospace",
}
)
.unwrap();
}
}
assert_eq!(
Type::create()
.as_enum(FontFamily::Type)
.values([FontFamily::Serif, FontFamily::Sans, FontFamily::Monospace])
.to_string(PostgresQueryBuilder),
r#"CREATE TYPE "font_family" AS ENUM ('serif', 'sans', 'monospace')"#
);
pub fn values<T, I>(&mut self, values: I) -> &mut Selfwhere
T: IntoIden,
I: IntoIterator<Item = T>,
source§impl TypeCreateStatement
impl TypeCreateStatement
pub fn build_ref<T: TypeBuilder>(&self, type_builder: &T) -> String
pub fn build_collect<T: TypeBuilder>( &self, type_builder: T, sql: &mut dyn SqlWriter, ) -> String
pub fn build_collect_ref<T: TypeBuilder>( &self, type_builder: &T, sql: &mut dyn SqlWriter, ) -> String
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 TypeCreateStatement
impl Clone for TypeCreateStatement
source§fn clone(&self) -> TypeCreateStatement
fn clone(&self) -> TypeCreateStatement
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 TypeCreateStatement
impl Debug for TypeCreateStatement
source§impl Default for TypeCreateStatement
impl Default for TypeCreateStatement
source§fn default() -> TypeCreateStatement
fn default() -> TypeCreateStatement
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TypeCreateStatement
impl !RefUnwindSafe for TypeCreateStatement
impl Send for TypeCreateStatement
impl Sync for TypeCreateStatement
impl Unpin for TypeCreateStatement
impl !UnwindSafe for TypeCreateStatement
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)