pub enum 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
impl PropertyValue
Sourcepub fn as_str(&self) -> Option<&str>
pub fn as_str(&self) -> Option<&str>
The &str inside a Text value; None for every other variant.
Sourcepub fn type_name(&self) -> &'static str
pub fn type_name(&self) -> &'static str
The tag name used in the envelope and in error/type reporting.
Sourcepub fn to_json(&self) -> Value
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.
Sourcepub fn to_compat_json(&self) -> Value
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§impl PropertyValue
impl PropertyValue
Sourcepub fn cmp_value(&self, other: &Self) -> Ordering
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.
Sourcepub fn is_sql_typed(&self) -> bool
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.
Sourcepub fn coerce_like(&self, like: &Self) -> Self
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.
Sourcepub fn eq_value(&self, other: &Self) -> bool
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
impl Clone for PropertyValue
Source§fn clone(&self) -> PropertyValue
fn clone(&self) -> PropertyValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more