pub struct Constraints {
pub min: Option<i64>,
pub max: Option<i64>,
pub min_length: Option<u64>,
pub max_length: Option<u64>,
pub pattern: Option<String>,
}Expand description
Value constraints attached to a Field.
These are language-agnostic validation metadata: a numeric range, a
string / array length bound, and a regular-expression pattern. They are
propagated to the Zod and SurrealQL emitters (which produce runtime
validators / database ASSERTs); the Rust and TypeScript type systems
cannot express them, so those emitters drop constraints entirely.
Fields§
§min: Option<i64>Inclusive lower bound for a numeric field (min=N).
max: Option<i64>Inclusive upper bound for a numeric field (max=N).
min_length: Option<u64>Inclusive minimum length for a string / array field (min_length=N).
max_length: Option<u64>Inclusive maximum length for a string / array field (max_length=N).
pattern: Option<String>A regular-expression pattern a string field must match (pattern="...").
Implementations§
Trait Implementations§
Source§impl Clone for Constraints
impl Clone for Constraints
Source§fn clone(&self) -> Constraints
fn clone(&self) -> Constraints
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Constraints
impl Debug for Constraints
Source§impl Default for Constraints
impl Default for Constraints
Source§fn default() -> Constraints
fn default() -> Constraints
Returns the “default value” for a type. Read more
Source§impl PartialEq for Constraints
impl PartialEq for Constraints
Source§fn eq(&self, other: &Constraints) -> bool
fn eq(&self, other: &Constraints) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for Constraints
impl StructuralPartialEq for Constraints
Auto Trait Implementations§
impl Freeze for Constraints
impl RefUnwindSafe for Constraints
impl Send for Constraints
impl Sync for Constraints
impl Unpin for Constraints
impl UnsafeUnpin for Constraints
impl UnwindSafe for Constraints
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