pub enum Value {
Show 24 variants
Account(Account),
Blob(Vec<u8>),
Bool(bool),
Date(Date),
Decimal(Decimal),
Duration(Duration),
Enum(ValueEnum),
Float32(Float32),
Float64(Float64),
Int(i64),
Int128(Int128),
IntBig(Int),
List(Vec<Self>),
Map(Vec<(Self, Self)>),
Null,
Principal(Principal),
Subaccount(Subaccount),
Text(String),
Timestamp(Timestamp),
Uint(u64),
Uint128(Nat128),
UintBig(Nat),
Ulid(Ulid),
Unit,
}Expand description
Value can be used in WHERE statements
Null → the field’s value is Option::None (i.e., SQL NULL). Unit → internal placeholder for RHS; not a real value.
Variants§
Account(Account)
Blob(Vec<u8>)
Bool(bool)
Date(Date)
Decimal(Decimal)
Duration(Duration)
Enum(ValueEnum)
Float32(Float32)
Float64(Float64)
Int(i64)
Int128(Int128)
IntBig(Int)
List(Vec<Self>)
Ordered list of values. Used for many-cardinality transport. List order is preserved for normalization and fingerprints.
Map(Vec<(Self, Self)>)
Canonical deterministic map representation.
- Maps are unordered values; insertion order is discarded.
- Entries are always sorted by canonical key order and keys are unique.
- Map fields are patchable through update views, but remain non-queryable.
- Persistence treats map fields as atomic value replacements per row save.
Null
Principal(Principal)
Subaccount(Subaccount)
Text(String)
Timestamp(Timestamp)
Uint(u64)
Uint128(Nat128)
UintBig(Nat)
Ulid(Ulid)
Unit
Implementations§
Source§impl Value
impl Value
Sourcepub fn from_slice<T>(items: &[T]) -> Self
pub fn from_slice<T>(items: &[T]) -> Self
CONSTRUCTION
Build a Value::List from a list literal.
Intended for tests and inline construction.
Requires Clone because items are borrowed.
Sourcepub fn from_list<T>(items: Vec<T>) -> Selfwhere
T: Into<Self>,
pub fn from_list<T>(items: Vec<T>) -> Selfwhere
T: Into<Self>,
Build a Value::List from owned items.
This is the canonical constructor for query / DTO boundaries.
Sourcepub fn from_map(entries: Vec<(Self, Self)>) -> Result<Self, MapValueError>
pub fn from_map(entries: Vec<(Self, Self)>) -> Result<Self, MapValueError>
Build a canonical Value::Map from owned key/value entries.
Invariants are validated and entries are normalized:
- keys must be scalar and non-null
- values must be scalar/ref-like (no collections)
- entries are sorted by canonical key order
- duplicate keys are rejected
Sourcepub fn validate_map_entries(
entries: &[(Self, Self)],
) -> Result<(), MapValueError>
pub fn validate_map_entries( entries: &[(Self, Self)], ) -> Result<(), MapValueError>
Validate map entry invariants without changing order.
Sourcepub fn normalize_map_entries(
entries: Vec<(Self, Self)>,
) -> Result<Vec<(Self, Self)>, MapValueError>
pub fn normalize_map_entries( entries: Vec<(Self, Self)>, ) -> Result<Vec<(Self, Self)>, MapValueError>
Normalize map entries into canonical deterministic order.
Sourcepub fn from_enum<E: EnumValue>(value: E) -> Self
pub fn from_enum<E: EnumValue>(value: E) -> Self
Build a Value::Enum from a domain enum using its explicit mapping.
Sourcepub fn enum_strict<E: Path>(variant: &str) -> Self
pub fn enum_strict<E: Path>(variant: &str) -> Self
Build a strict enum value using the canonical path of E.
Sourcepub const fn is_numeric(&self) -> bool
pub const fn is_numeric(&self) -> bool
TYPES
Returns true if the value is one of the numeric-like variants supported by numeric comparison/ordering.
Sourcepub const fn supports_numeric_coercion(&self) -> bool
pub const fn supports_numeric_coercion(&self) -> bool
Returns true when numeric coercion/comparison is explicitly allowed.
Sourcepub const fn is_unit(&self) -> bool
pub const fn is_unit(&self) -> bool
Returns true if the value is Unit (used for presence/null comparators).
pub const fn is_scalar(&self) -> bool
Sourcepub fn canonical_cmp_key(left: &Self, right: &Self) -> Ordering
pub fn canonical_cmp_key(left: &Self, right: &Self) -> Ordering
Total canonical comparator used for map-key normalization.
Sourcepub const fn as_storage_key(&self) -> Option<StorageKey>
pub const fn as_storage_key(&self) -> Option<StorageKey>
CONVERSION
NOTE:
Unit is intentionally treated as a valid storage key and indexable,
used for singleton tables and synthetic identity entities.
Only Null is non-indexable.
pub const fn as_text(&self) -> Option<&str>
pub const fn as_list(&self) -> Option<&[Self]>
pub const fn as_map(&self) -> Option<&[(Self, Self)]>
Sourcepub fn cmp_numeric(&self, other: &Self) -> Option<Ordering>
pub fn cmp_numeric(&self, other: &Self) -> Option<Ordering>
Cross-type numeric comparison; returns None if non-numeric.
Sourcepub fn text_eq(&self, other: &Self, mode: TextMode) -> Option<bool>
pub fn text_eq(&self, other: &Self, mode: TextMode) -> Option<bool>
Case-sensitive/insensitive equality check for text-like values.
Sourcepub fn text_contains(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_contains(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether other is a substring of self under the given text mode.
Sourcepub fn text_starts_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_starts_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether self starts with other under the given text mode.
Sourcepub fn text_ends_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
pub fn text_ends_with(&self, needle: &Self, mode: TextMode) -> Option<bool>
Check whether self ends with other under the given text mode.
Sourcepub fn is_not_empty(&self) -> Option<bool>
pub fn is_not_empty(&self) -> Option<bool>
Logical negation of is_empty.
Sourcepub fn contains(&self, needle: &Self) -> Option<bool>
pub fn contains(&self, needle: &Self) -> Option<bool>
COLLECTIONS
Returns true if self contains needle (or equals it for scalars).
Sourcepub fn contains_any(&self, needles: &Self) -> Option<bool>
pub fn contains_any(&self, needles: &Self) -> Option<bool>
Returns true if any item in needles matches a member of self.
Sourcepub fn contains_all(&self, needles: &Self) -> Option<bool>
pub fn contains_all(&self, needles: &Self) -> Option<bool>
Returns true if every item in needles matches a member of self.
Sourcepub fn in_list(&self, haystack: &Self) -> Option<bool>
pub fn in_list(&self, haystack: &Self) -> Option<bool>
Returns true if self exists inside the provided list.
Sourcepub fn contains_ci(&self, needle: &Self) -> Option<bool>
pub fn contains_ci(&self, needle: &Self) -> Option<bool>
Case-insensitive contains supporting text and identifier variants.
Sourcepub fn contains_any_ci(&self, needles: &Self) -> Option<bool>
pub fn contains_any_ci(&self, needles: &Self) -> Option<bool>
Case-insensitive variant of contains_any.
Sourcepub fn contains_all_ci(&self, needles: &Self) -> Option<bool>
pub fn contains_all_ci(&self, needles: &Self) -> Option<bool>
Case-insensitive variant of contains_all.
Sourcepub fn in_list_ci(&self, haystack: &Self) -> Option<bool>
pub fn in_list_ci(&self, haystack: &Self) -> Option<bool>
Case-insensitive variant of in_list.
Trait Implementations§
Source§impl CandidType for Value
impl CandidType for Value
Source§impl CoercionFamilyExt for Value
impl CoercionFamilyExt for Value
Source§fn coercion_family(&self) -> CoercionFamily
fn coercion_family(&self) -> CoercionFamily
Returns the coercion-routing family for this value.
NOTE: This does NOT imply numeric, arithmetic, ordering, or keyability support. All scalar capabilities are registry-driven.