Struct sea_query::extension::postgres::TypeCreateStatement
source ยท 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 !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