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>§nullable: bool§default: Option<String>§auto_increment: bool§unique: bool§comment: Option<String>§precision: Option<(u32, u32)>§after: Option<String>Implementations§
Source§impl ColumnOptions
impl ColumnOptions
Sourcepub fn limit(self, len: usize) -> ColumnOptions
pub fn limit(self, len: usize) -> ColumnOptions
设置列长度(VARCHAR 长度等)
Sourcepub fn not_null(self) -> ColumnOptions
pub fn not_null(self) -> ColumnOptions
设置为 NOT NULL(默认是 nullable)
Sourcepub fn default_value(self, value: impl Into<String>) -> ColumnOptions
pub fn default_value(self, value: impl Into<String>) -> ColumnOptions
设置默认值
Sourcepub fn auto_increment(self) -> ColumnOptions
pub fn auto_increment(self) -> ColumnOptions
设置为自增主键
Sourcepub fn unique(self) -> ColumnOptions
pub fn unique(self) -> ColumnOptions
设置为唯一
Sourcepub fn comment(self, comment: impl Into<String>) -> ColumnOptions
pub fn comment(self, comment: impl Into<String>) -> ColumnOptions
设置列注释
Sourcepub fn precision(self, p: u32, s: u32) -> ColumnOptions
pub fn precision(self, p: u32, s: u32) -> ColumnOptions
设置 DECIMAL 精度(precision, scale)
Sourcepub fn after(self, column: impl Into<String>) -> ColumnOptions
pub fn after(self, column: impl Into<String>) -> ColumnOptions
MySQL AFTER 子句(指定列插入位置)
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
Source§impl Default for ColumnOptions
impl Default for ColumnOptions
Source§fn default() -> ColumnOptions
fn default() -> ColumnOptions
Returns the “default value” for a type. Read more
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
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