pub enum FieldAttribute {
Id,
Unique,
Default(Expr, Span),
Map(String),
Store {
strategy: StorageStrategy,
span: Span,
},
Relation {
name: Option<String>,
fields: Option<Vec<Ident>>,
references: Option<Vec<Ident>>,
on_delete: Option<ReferentialAction>,
on_update: Option<ReferentialAction>,
span: Span,
},
UpdatedAt {
span: Span,
},
Computed {
expr: SqlExpr,
kind: ComputedKind,
span: Span,
},
Check {
expr: BoolExpr,
span: Span,
},
}Expand description
A field-level attribute (@id, @unique, etc.).
Variants§
Id
@id attribute.
Unique
@unique attribute.
Default(Expr, Span)
@default(value) attribute.
The Span covers the full @default(...) token range.
Map(String)
@map(“name”) attribute.
Store
@store(json) attribute for array storage strategy.
Fields
§
strategy: StorageStrategyStorage strategy (currently only “json” supported).
Relation
@relation(…) attribute.
Fields
§
on_delete: Option<ReferentialAction>onDelete: Cascade | SetNull | …
§
on_update: Option<ReferentialAction>onUpdate: Cascade | SetNull | …
UpdatedAt
@updatedAt — auto-set to current timestamp on every write.
Computed
@computed(expr, Stored | Virtual) — database-generated column.
Fields
§
kind: ComputedKindWhether the value is stored on disk or computed on every read.
Check
@check(bool_expr) — column-level CHECK constraint.
Trait Implementations§
Source§impl Clone for FieldAttribute
impl Clone for FieldAttribute
Source§fn clone(&self) -> FieldAttribute
fn clone(&self) -> FieldAttribute
Returns a duplicate of the value. Read more
1.0.0 · 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 FieldAttribute
impl Debug for FieldAttribute
Source§impl PartialEq for FieldAttribute
impl PartialEq for FieldAttribute
impl StructuralPartialEq for FieldAttribute
Auto Trait Implementations§
impl Freeze for FieldAttribute
impl RefUnwindSafe for FieldAttribute
impl Send for FieldAttribute
impl Sync for FieldAttribute
impl Unpin for FieldAttribute
impl UnsafeUnpin for FieldAttribute
impl UnwindSafe for FieldAttribute
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