Struct sea_query::extension::postgres::TypeCreateStatement [−][src]
pub struct TypeCreateStatement { /* fields omitted */ }This is supported on crate feature
backend-postgres only.Implementations
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 std::fmt::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(vec![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 Self where
T: IntoIden,
I: IntoIterator<Item = T>, pub fn build_collect<T: TypeBuilder>(
&self,
type_builder: T,
collector: &mut dyn FnMut(Value)
) -> Stringpub fn build_collect_ref<T: TypeBuilder>(
&self,
type_builder: &T,
collector: &mut dyn FnMut(Value)
) -> StringBuild corresponding SQL statement and return SQL string
Trait Implementations
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for TypeCreateStatementimpl !Send for TypeCreateStatementimpl !Sync for TypeCreateStatementimpl Unpin for TypeCreateStatementimpl !UnwindSafe for TypeCreateStatementBlanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = TShould always be Self
pub fn vzip(self) -> V