pub struct Radio<T> { /* private fields */ }Expand description
保留 Rust 值类型信息的 Radio Builder;运行时 Catalog 存储稳定字符串值。
Implementations§
Source§impl<T> Radio<T>
impl<T> Radio<T>
Sourcepub fn widget(self, value: WidgetHint) -> Self
pub fn widget(self, value: WidgetHint) -> Self
设置前端控件提示;不改变枚举值集合。
Sourcepub fn varchar(self, max_length: usize) -> Self
pub fn varchar(self, max_length: usize) -> Self
使用 VARCHAR 作为物理存储,同时保留 Radio 候选值的应用层校验。
适用于需要通过前向 CHECK 迁移约束既有 VARCHAR 列的场景;未调用时仍使用
数据库原生 ENUM。max_length 必须覆盖所有候选值。
Sourcepub fn native_enum(self, type_name: impl Into<String>) -> Self
pub fn native_enum(self, type_name: impl Into<String>) -> Self
复用 PostgreSQL 原生枚举类型(CREATE TYPE ... AS ENUM)。
与 Self::varchar 互斥;MySQL 方言在渲染 DDL 时明确拒绝。声明后
PostgreSQL 不再生成隐式 VARCHAR + CHECK,而是直接使用该枚举类型。
Sourcepub fn filterable(self, value: bool) -> Self
pub fn filterable(self, value: bool) -> Self
设置是否允许结构化条件筛选。
Trait Implementations§
Source§impl<T> IntoFieldSpec for Radio<T>
impl<T> IntoFieldSpec for Radio<T>
Source§fn into_field_spec(self, name: FieldName) -> FieldSpec
fn into_field_spec(self, name: FieldName) -> FieldSpec
绑定字段名并生成唯一原生定义。
Auto Trait Implementations§
impl<T> Forget for Radio<T>
impl<T> Freeze for Radio<T>
impl<T> Move for Radio<T>
impl<T> RefUnwindSafe for Radio<T>
impl<T> Send for Radio<T>
impl<T> Sync for Radio<T>
impl<T> Unpin for Radio<T>
impl<T> UnsafeUnpin for Radio<T>
impl<T> UnwindSafe for Radio<T>
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