Struct sea_query::extension::postgres::TypeAlterStatement [−][src]
pub struct TypeAlterStatement { /* fields omitted */ }This is supported on crate feature
backend-postgres only.Implementations
Change the definition of a 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::alter() .name(FontFamily::Type) .add_value(Alias::new("cursive")) .to_string(PostgresQueryBuilder), r#"ALTER TYPE "font_family" ADD VALUE 'cursive'"# );
Add a enum value before an existing value
use sea_query::{*, tests_cfg::*, extension::postgres::Type}; assert_eq!( Type::alter() .name(Font::Table) .add_value(Alias::new("weight")) .before(Font::Variant) .to_string(PostgresQueryBuilder), r#"ALTER TYPE "font" ADD VALUE 'weight' BEFORE 'variant'"# )
pub fn rename_value<T, V>(self, existing: T, new_name: V) -> Self where
T: IntoIden,
V: IntoIden,
pub fn rename_value<T, V>(self, existing: T, new_name: V) -> Self where
T: IntoIden,
V: IntoIden, Rename a enum value
use sea_query::{*, tests_cfg::*, extension::postgres::Type}; assert_eq!( Type::alter() .name(Font::Table) .rename_value(Alias::new("variant"), Alias::new("language")) .to_string(PostgresQueryBuilder), r#"ALTER TYPE "font" RENAME VALUE 'variant' TO 'language'"# )
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 TypeAlterStatementimpl !Send for TypeAlterStatementimpl !Sync for TypeAlterStatementimpl Unpin for TypeAlterStatementimpl !UnwindSafe for TypeAlterStatementBlanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = TShould always be Self
pub fn vzip(self) -> V