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