pub struct Field {
pub ty: FieldType,
pub references: Option<String>,
pub required: bool,
pub unique: bool,
pub hidden: bool,
pub default: Option<Value>,
pub max_length: Option<u32>,
pub case: Option<TextCase>,
pub on_delete: Option<OnDelete>,
pub admin: FieldAdmin,
}Expand description
One column in a resource.
Fields§
§ty: FieldType§references: Option<String>Target resource name when ty == Reference.
required: bool§unique: boolExclude from API responses (e.g. password hashes).
default: Option<Value>Optional default rendered as a SQL literal.
max_length: Option<u32>§case: Option<TextCase>Force a text field to one case, in storage and in every response.
For values that are codes rather than prose — a currency, a country,
a ticket prefix, a coupon. Those have a conventional case, and the
difference between eur and EUR is a spelling rather than a
distinction: left alone it produces two of everything, and a filter
that matches whichever one the caller happened to type.
Only meaningful on string and text; ignored elsewhere, because
there is no case to change about a number.
on_delete: Option<OnDelete>For reference fields: what happens to this row when the referenced row
is deleted. Defaults to OnDelete::Restrict (safe: blocks orphaning).
admin: FieldAdminDashboard presentation for this field, from [fields.<name>.admin].