pub struct ColumnOptions {
pub limit: Option<usize>,
pub nullable: bool,
pub default: Option<String>,
pub auto_increment: bool,
pub unique: bool,
pub comment: Option<String>,
pub precision: Option<(u32, u32)>,
pub after: Option<String>,
}Expand description
列选项构建器(Phinx 风格链式配置)
Fields§
§limit: Option<usize>列长度(如 VARCHAR 长度)
nullable: bool是否允许 NULL
default: Option<String>默认值
auto_increment: bool是否自增
unique: bool是否唯一
comment: Option<String>列注释
precision: Option<(u32, u32)>DECIMAL 精度(precision, scale)
after: Option<String>MySQL AFTER 子句(指定列插入位置)
Implementations§
Source§impl ColumnOptions
impl ColumnOptions
Sourcepub fn default_value(self, value: impl Into<String>) -> Self
pub fn default_value(self, value: impl Into<String>) -> Self
设置默认值
Sourcepub fn auto_increment(self) -> Self
pub fn auto_increment(self) -> Self
设置为自增主键
Trait Implementations§
Source§impl Clone for ColumnOptions
impl Clone for ColumnOptions
Source§fn clone(&self) -> ColumnOptions
fn clone(&self) -> ColumnOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ColumnOptions
impl Debug for ColumnOptions
Auto Trait Implementations§
impl Freeze for ColumnOptions
impl RefUnwindSafe for ColumnOptions
impl Send for ColumnOptions
impl Sync for ColumnOptions
impl Unpin for ColumnOptions
impl UnsafeUnpin for ColumnOptions
impl UnwindSafe for ColumnOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more