Skip to main content

PropertyValue

Enum PropertyValue 

Source
pub enum PropertyValue {
Show 15 variants Null, Bool(bool), Long(i64), Float(f64), Text(String), Json(Value), Int32(i32), Int16(i16), Decimal(Decimal), Date(NaiveDate), Time(NaiveTime), Timestamp(DateTime<FixedOffset>), Uuid(Uuid), Bytes(Vec<u8>), Array(Vec<PropertyValue>),
}
Expand description

Typed property value, at SQL fidelity.

Variants§

§

Null

SQL NULL / JSON null.

§

Bool(bool)

Boolean.

§

Long(i64)

SQL BIGINT.

§

Float(f64)

SQL DOUBLE PRECISION. Already a double — the gap this type had was never width, it was exactness, and Decimal fills that.

§

Text(String)

Free-form text.

§

Json(Value)

Arbitrary nested JSON (JSONB columns, document subdocuments).

§

Int32(i32)

SQL INT/INTEGER. Distinct from Long so a 32-bit column does not silently come back 64-bit on round-trip.

§

Int16(i16)

SQL SMALLINT.

§

Decimal(Decimal)

SQL DECIMAL/NUMERIC and money. Exact — never f64.

§

Date(NaiveDate)

SQL DATE.

§

Time(NaiveTime)

SQL TIME.

§

Timestamp(DateTime<FixedOffset>)

SQL TIMESTAMP WITH TIME ZONE. The offset is part of the value and is preserved verbatim: +02:00 does not come back as Z.

§

Uuid(Uuid)

SQL UUID/UNIQUEIDENTIFIER.

§

Bytes(Vec<u8>)

SQL BLOB/BYTEA/VARBINARY. Base64 in every JSON form.

§

Array(Vec<PropertyValue>)

SQL array / document-store array. Elements are themselves typed, so Array<Decimal> stays exact.

Implementations§

Source§

impl PropertyValue

Source

pub fn as_str(&self) -> Option<&str>

The &str inside a Text value; None for every other variant.

Source

pub fn type_name(&self) -> &'static str

The tag name used in the envelope and in error/type reporting.

Source

pub fn to_json(&self) -> Value

The type-PRESERVING JSON form: what serde emits, what RocksDB stores, and what a .ant file carries. Legacy variants are bare scalars; SQL-parity variants are envelopes.

Source

pub fn to_compat_json(&self) -> Value

The BACKWARD-COMPATIBLE JSON form for /public/v1: every typed value flattened to the bare scalar it would have been stored as before SQL parity existed.

Deliberately lossy. The KAG-compatible surface has a published shape and a generation of clients that parse it; emitting an envelope there would widen the contract for every caller, in exchange for a type they never asked for. Callers who want the types use the Antares-native API.

Source

pub fn from_json(v: Value) -> Self

Read the type-preserving form back. Unknown/!malformed envelopes fall through to Json, so no input is ever rejected here — this runs against stored data, where refusing to decode would mean losing a record that is already durable.

Source§

impl PropertyValue

Source

pub fn cmp_value(&self, other: &Self) -> Ordering

Total ordering used by ORDER BY and by range comparisons.

Within a rank the comparison is type-appropriate: integers and decimals compare EXACTLY (a decimal never round-trips through f64 to be compared), timestamps compare as instants so a +02:00 value orders correctly against a Z one, bytes compare lexicographically, and arrays compare element-wise then by length.

Source

pub fn is_sql_typed(&self) -> bool

Whether this carries one of the SQL-parity types — i.e. a value whose wire form is a tagged envelope.

Source

pub fn coerce_like(&self, like: &Self) -> Self

Reinterpret an untyped literal as the type of like.

A query says WHERE due = "2024-03-01" or WHERE amount > "10.50". The literal arrives as Text — the query language has no date or decimal literal — so comparing it against a stored Date or Decimal by cross-type rank would silently match nothing. This pulls the literal to the stored value’s type so the comparison is the one the caller meant.

Returns self unchanged when the coercion does not apply or the literal does not parse as that type; the comparison then falls back to cross-type ordering rather than inventing a match.

Source

pub fn eq_value(&self, other: &Self) -> bool

Equality by VALUE rather than by representation: Long(1) equals Int32(1) equals Decimal("1.0"), and a +02:00 timestamp equals the same instant written as Z. This is what a filter comparison uses; derived PartialEq stays representation-exact for tests and dedup.

Trait Implementations§

Source§

impl Clone for PropertyValue

Source§

fn clone(&self) -> PropertyValue

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PropertyValue

Source§

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

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

impl<'de> Deserialize<'de> for PropertyValue

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

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

impl PartialEq for PropertyValue

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for PropertyValue

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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 PropertyValue

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

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

impl StructuralPartialEq for PropertyValue

Auto Trait Implementations§

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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.