pub struct TypeGuardFieldDef {
pub field: String,
pub type_expr: String,
pub required: bool,
pub check_expr: Option<String>,
pub default_expr: Option<String>,
pub value_expr: Option<String>,
}Expand description
A single field guard: type check + optional REQUIRED + optional CHECK expression.
Stored as part of the collection metadata in the catalog.
The check_expr is stored as a string (the original SQL expression text)
and parsed into an evaluable form at enforcement time.
Fields§
§field: StringField name. Supports dot-path for nested fields (e.g., “metadata.source”).
type_expr: StringType expression string (e.g., “STRING”, “INT|NULL”, “ARRAY
required: boolWhether the field must be present and non-null on every write.
check_expr: Option<String>Optional CHECK expression as SQL text (e.g., “amount > 0”). Stored as text, parsed at enforcement time.
default_expr: Option<String>DEFAULT expression: injected if the field is absent on write.
Does NOT overwrite a user-provided value.
Example: DEFAULT 'draft', DEFAULT gen_uuid_v7(), DEFAULT now().
value_expr: Option<String>VALUE expression: always injected, even if the field is provided.
Overwrites user input — use for computed/derived fields.
Example: VALUE now(), VALUE LOWER(REPLACE(title, ' ', '-')).
Trait Implementations§
Source§impl Clone for TypeGuardFieldDef
impl Clone for TypeGuardFieldDef
Source§fn clone(&self) -> TypeGuardFieldDef
fn clone(&self) -> TypeGuardFieldDef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TypeGuardFieldDef
impl Debug for TypeGuardFieldDef
Source§impl<'de> Deserialize<'de> for TypeGuardFieldDef
impl<'de> Deserialize<'de> for TypeGuardFieldDef
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<'__msgpack_de> FromMessagePack<'__msgpack_de> for TypeGuardFieldDef
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for TypeGuardFieldDef
Source§impl PartialEq for TypeGuardFieldDef
impl PartialEq for TypeGuardFieldDef
Source§impl Serialize for TypeGuardFieldDef
impl Serialize for TypeGuardFieldDef
Source§impl ToMessagePack for TypeGuardFieldDef
impl ToMessagePack for TypeGuardFieldDef
impl StructuralPartialEq for TypeGuardFieldDef
Auto Trait Implementations§
impl Freeze for TypeGuardFieldDef
impl RefUnwindSafe for TypeGuardFieldDef
impl Send for TypeGuardFieldDef
impl Sync for TypeGuardFieldDef
impl Unpin for TypeGuardFieldDef
impl UnsafeUnpin for TypeGuardFieldDef
impl UnwindSafe for TypeGuardFieldDef
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.