Value

Enum Value 

Source
pub enum Value {
Show 26 variants Account(Account), Blob(Vec<u8>), Bool(bool), Date(Date), Decimal(Decimal), Duration(Duration), Enum(ValueEnum), E8s(E8s), E18s(E18s), Float32(Float32), Float64(Float64), Int(i64), Int128(Int128), IntBig(Int), List(Vec<Self>), None, Principal(Principal), Subaccount(Subaccount), Text(String), Timestamp(Timestamp), Uint(u64), Uint128(Nat128), UintBig(Nat), Ulid(Ulid), Unit, Unsupported,
}
Expand description

Value can be used in WHERE statements

None → the field’s value is Option::None (i.e., SQL NULL). Unit → internal placeholder for RHS; not a real value. Unsupported → the field exists but isn’t filterable/indexable.

Variants§

§

Account(Account)

§

Blob(Vec<u8>)

§

Bool(bool)

§

Date(Date)

§

Decimal(Decimal)

§

Duration(Duration)

§

Enum(ValueEnum)

§

E8s(E8s)

§

E18s(E18s)

§

Float32(Float32)

§

Float64(Float64)

§

Int(i64)

§

Int128(Int128)

§

IntBig(Int)

§

List(Vec<Self>)

§

None

§

Principal(Principal)

§

Subaccount(Subaccount)

§

Text(String)

§

Timestamp(Timestamp)

§

Uint(u64)

§

Uint128(Nat128)

§

UintBig(Nat)

§

Ulid(Ulid)

§

Unit

§

Unsupported

Implementations§

Source§

impl Value

Source

pub const fn tag(&self) -> u8

HASHING

Source§

impl Value

Source

pub fn hash_value(&self) -> [u8; 16]

Stable hash used for index/storage fingerprints.

Source§

impl Value

Source

pub fn from_list<T: Into<Self> + Clone>(items: &[T]) -> Self

CONSTRUCTION

Build a Value::List from a slice of items convertible into Value.

Source

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.

Source

pub const fn is_text(&self) -> bool

Returns true if the value is Text.

Source

pub const fn is_unit(&self) -> bool

Returns true if the value is Unit (used for presence/null comparators).

Source

pub const fn is_scalar(&self) -> bool

Source

pub const fn as_key(&self) -> Option<Key>

CONVERSION

NOTE: Unit is intentionally treated as a valid key and indexable, used for tables with exactly one row or synthetic “single identity” entities. Only None and Unsupported are non-indexable.

Source

pub const fn as_text(&self) -> Option<&str>

Source

pub const fn as_list(&self) -> Option<&[Self]>

Source

pub fn to_index_fingerprint(&self) -> Option<[u8; 16]>

Stable 128-bit hash used for index keys; returns None for non-indexable values.

Source

pub fn cmp_numeric(&self, other: &Self) -> Option<Ordering>

Cross-type numeric comparison; returns None if non-numeric.

Source

pub fn text_eq(&self, other: &Self, mode: TextMode) -> Option<bool>

Case-sensitive/insensitive equality check for text-like values.

Source

pub fn text_contains(&self, needle: &Self, mode: TextMode) -> Option<bool>

Check whether other is a substring of self under the given text mode.

Source

pub fn text_starts_with(&self, needle: &Self, mode: TextMode) -> Option<bool>

Check whether self starts with other under the given text mode.

Source

pub fn text_ends_with(&self, needle: &Self, mode: TextMode) -> Option<bool>

Check whether self ends with other under the given text mode.

Source

pub const fn is_empty(&self) -> Option<bool>

EMPTY

Source

pub fn is_not_empty(&self) -> Option<bool>

Logical negation of is_empty.

Source

pub fn contains(&self, needle: &Self) -> Option<bool>

COLLECTIONS

Returns true if self contains needle (or equals it for scalars).

Source

pub fn contains_any(&self, needles: &Self) -> Option<bool>

Returns true if any item in needles matches a member of self.

Source

pub fn contains_all(&self, needles: &Self) -> Option<bool>

Returns true if every item in needles matches a member of self.

Source

pub fn in_list(&self, haystack: &Self) -> Option<bool>

Returns true if self exists inside the provided list.

Source

pub fn contains_ci(&self, needle: &Self) -> Option<bool>

Case-insensitive contains supporting text and identifier variants.

Source

pub fn contains_any_ci(&self, needles: &Self) -> Option<bool>

Case-insensitive variant of contains_any.

Source

pub fn contains_all_ci(&self, needles: &Self) -> Option<bool>

Case-insensitive variant of contains_all.

Source

pub fn in_list_ci(&self, haystack: &Self) -> Option<bool>

Case-insensitive variant of in_list.

Trait Implementations§

Source§

impl CandidType for Value

Source§

fn _ty() -> Type

Source§

fn id() -> TypeId

Source§

fn idl_serialize<__S>(&self, __serializer: __S) -> Result<(), __S::Error>
where __S: Serializer,

Source§

fn ty() -> Type

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Value

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl FieldValue for Value

Source§

fn to_value(&self) -> Value

Source§

impl From<&str> for Value

Source§

fn from(v: &str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for Value

Source§

fn from((): ()) -> Self

Converts to this type from the input type.
Source§

impl From<Account> for Value

Source§

fn from(v: Account) -> Self

Converts to this type from the input type.
Source§

impl From<Date> for Value

Source§

fn from(v: Date) -> Self

Converts to this type from the input type.
Source§

impl From<Decimal> for Value

Source§

fn from(v: Decimal) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Value

Source§

fn from(v: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<E18s> for Value

Source§

fn from(v: E18s) -> Self

Converts to this type from the input type.
Source§

impl From<E8s> for Value

Source§

fn from(v: E8s) -> Self

Converts to this type from the input type.
Source§

impl From<Int> for Value

Source§

fn from(v: Int) -> Self

Converts to this type from the input type.
Source§

impl From<Nat> for Value

Source§

fn from(v: Nat) -> Self

Converts to this type from the input type.
Source§

impl From<Principal> for Value

Source§

fn from(v: Principal) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Value

Source§

fn from(v: String) -> Self

Converts to this type from the input type.
Source§

impl From<Subaccount> for Value

Source§

fn from(v: Subaccount) -> Self

Converts to this type from the input type.
Source§

impl From<Timestamp> for Value

Source§

fn from(v: Timestamp) -> Self

Converts to this type from the input type.
Source§

impl From<Ulid> for Value

Source§

fn from(v: Ulid) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<Value>> for Value

Source§

fn from(vec: Vec<Self>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for Value

Source§

fn from(v: bool) -> Self

Converts to this type from the input type.
Source§

impl From<i128> for Value

Source§

fn from(v: i128) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Value

Source§

fn from(v: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Value

Source§

fn from(v: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Value

Source§

fn from(v: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Value

Source§

fn from(v: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u128> for Value

Source§

fn from(v: u128) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Value

Source§

fn from(v: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Value

Source§

fn from(v: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for Value

Source§

fn from(v: u64) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Value

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Value

Source§

fn eq(&self, other: &Value) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Value

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Value

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ValueFamilyExt for Value

Source§

impl Eq for Value

Source§

impl StructuralPartialEq for Value

Auto Trait Implementations§

§

impl Freeze for Value

§

impl RefUnwindSafe for Value

§

impl Send for Value

§

impl Sync for Value

§

impl Unpin for Value

§

impl UnwindSafe for Value

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,