pub struct FieldSchema {Show 16 fields
pub field_type: FieldType,
pub primary: bool,
pub generated: bool,
pub required: bool,
pub unique: bool,
pub nullable: bool,
pub reference: Option<String>,
pub min: Option<Value>,
pub max: Option<Value>,
pub format: Option<String>,
pub values: Option<Vec<String>>,
pub default: Option<Value>,
pub sensitive: bool,
pub search: bool,
pub items: Option<ItemsSpec>,
pub transient: bool,
}Expand description
Definition of a single field in a resource schema.
Matches the inline YAML format:
email: { type: string, format: email, unique: true, required: true }Fields§
§field_type: FieldTypeThe data type of this field.
primary: boolWhether this field is the primary key.
generated: boolWhether this field is auto-generated (e.g., uuid v4, timestamps).
required: boolWhether this field is required (NOT NULL + validated on input).
unique: boolWhether this field has a unique constraint.
nullable: boolWhether this field is explicitly nullable.
reference: Option<String>Foreign key reference in resource.field format.
min: Option<Value>Minimum value (number) or length (string).
max: Option<Value>Maximum value (number) or length (string).
format: Option<String>String format validation (email, url, uuid).
values: Option<Vec<String>>Allowed values for enum-type fields.
default: Option<Value>Default value for this field.
sensitive: boolWhether this field contains sensitive data (redacted in logs).
search: boolWhether this field is included in full-text search.
items: Option<ItemsSpec>Element type for array fields.
transient: boolInput-only field: validated and exposed to the before-controller in ctx.input,
but never persisted (no migration column, no SQL reference) and never returned
in API responses. Stripped from ctx.input after the before-controller runs.
Implementations§
Source§impl FieldSchema
impl FieldSchema
Sourcepub fn is_persisted(&self) -> bool
pub fn is_persisted(&self) -> bool
Returns true if this field is stored in the database. Transient fields exist only at the API boundary and are never persisted.
Trait Implementations§
Source§impl Clone for FieldSchema
impl Clone for FieldSchema
Source§fn clone(&self) -> FieldSchema
fn clone(&self) -> FieldSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldSchema
impl Debug for FieldSchema
Source§impl<'de> Deserialize<'de> for FieldSchema
impl<'de> Deserialize<'de> for FieldSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for FieldSchema
impl PartialEq for FieldSchema
Source§impl Serialize for FieldSchema
impl Serialize for FieldSchema
impl StructuralPartialEq for FieldSchema
Auto Trait Implementations§
impl Freeze for FieldSchema
impl RefUnwindSafe for FieldSchema
impl Send for FieldSchema
impl Sync for FieldSchema
impl Unpin for FieldSchema
impl UnsafeUnpin for FieldSchema
impl UnwindSafe for FieldSchema
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
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>
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>
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