pub enum Value {
Show 21 variants
Null,
Void,
Bool(bool),
Int(i64),
Float(f64),
Str(String),
FixedChar(String),
Bytes(Vec<u8>),
Temporal(TemporalValue),
Decimal(DecimalValue),
Json(String),
JsonB(String),
Array(ArrayValue),
LegacyVector(LegacyVectorValue),
List(Vec<Value>),
Row(RowValue),
Record(RecordValue),
Map(BTreeMap<String, Value>),
Enum(EnumValue),
Datum(DatumValue),
BitString(BitStringValue),
}Expand description
Dynamic value type for document fields and posting payload extras.
Covers the JSON-like values the engine round-trips through a posting list. Date and datetime variants land with the SQL type system.
Variants§
Null
Void
Non-null zero-width value of PostgreSQL’s void pseudo-type.
Bool(bool)
Int(i64)
Float(f64)
Str(String)
FixedChar(String)
A PostgreSQL blank-padded CHARACTER(n) value. The stored string
includes its physical trailing spaces; SQL comparisons ignore them.
Bytes(Vec<u8>)
Temporal(TemporalValue)
Decimal(DecimalValue)
Json(String)
Validated PostgreSQL json text. Unlike jsonb, the original
whitespace and object-key order are preserved.
JsonB(String)
Canonical PostgreSQL jsonb text. Keeping a distinct carrier
preserves JSON scalars and arrays across SQL, storage, and bindings.
Array(ArrayValue)
SQL array value with PostgreSQL dimension lower bounds.
LegacyVector(LegacyVectorValue)
Atomic int2vector or oidvector with a zero-based array view.
List(Vec<Value>)
Internal generic sequence carrier for vectors, tensors, JSON arrays,
graph lists, and callback payloads. SQL arrays use Value::Array.
Row(RowValue)
Anonymous ROW(...) constructor. This stays distinct from arrays so
row comparisons retain SQL three-valued NULL semantics.
Record(RecordValue)
Named composite/record value in physical field order.
Map(BTreeMap<String, Value>)
JSON/document object value. This is not a SQL composite record.
Enum(EnumValue)
Label of a user-defined enum type. The immutable label key orders values in declaration order; label text is resolved from the catalog.
Datum(DatumValue)
A retained SQL field that has not been physically interpreted. SQL must read it before value-based operations; NULL tests and type inspection do not read its bytes.
BitString(BitStringValue)
A finite packed bit sequence. SQL’s declaration descriptor distinguishes fixed and varying length constraints.
Implementations§
Source§impl Value
impl Value
Sourcepub fn cmp_with_control(
&self,
other: &Value,
control: &ProductionControl<'_>,
) -> Result<Ordering, ValueRetentionError>
pub fn cmp_with_control( &self, other: &Value, control: &ProductionControl<'_>, ) -> Result<Ordering, ValueRetentionError>
Compare through the existing numeric and JSONB owners under the producer’s allowance. Borrowed scalar comparisons allocate nothing; recursive carriers retain traversal and comparison scratch only for the call.
Source§impl Value
impl Value
Sourcepub fn clone_budgeted(
&self,
budget: &MemoryBudget,
cancellation: &CancellationToken,
) -> Result<Budgeted<Value>, ValueRetentionError>
pub fn clone_budgeted( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<Budgeted<Value>, ValueRetentionError>
Copy the value under one allowance, retaining the destination’s payload lease. Buffer capacity, array headers, decimal payloads and live map entries follow reserve_retained_payload; opaque B-tree node slack and allocator bookkeeping have the same separate ownership. Traversal uses a charged stack and checks cancellation between children and bounded string/byte chunks.
Sourcepub fn clone_budgeted_with_check(
&self,
budget: &MemoryBudget,
check: impl FnMut() -> Result<(), QueryCancelled>,
) -> Result<Budgeted<Value>, ValueRetentionError>
pub fn clone_budgeted_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<Budgeted<Value>, ValueRetentionError>
Copy under the same payload and traversal contract as Self::clone_budgeted, checking all caller-owned cancellation scopes through one callback between children and bounded payload chunks. This supports retained resources whose original caller and current reader both remain cancellation owners.
Sourcepub fn transform_with_control<E>(
&self,
control: &ProductionControl<'_>,
replace: impl FnMut(&Value) -> Result<Option<Produced<Value>>, E>,
) -> Result<Produced<Value>, E>where
E: From<ValueRetentionError>,
pub fn transform_with_control<E>(
&self,
control: &ProductionControl<'_>,
replace: impl FnMut(&Value) -> Result<Option<Produced<Value>>, E>,
) -> Result<Produced<Value>, E>where
E: From<ValueRetentionError>,
Copy native containers with an iterative, admitted traversal. A replacement owns its admitted payload under the same control and stops traversal at that node; all other nodes preserve their shape, bounds and descriptors. Replacements are never interpreted by Core. A failed transform releases every partial copy.
Source§impl Value
impl Value
Sourcepub fn from_json_fields_budgeted(
fields: Budgeted<BTreeMap<String, Value>>,
cancellation: &CancellationToken,
) -> Result<Budgeted<Value>, JsonReadError>
pub fn from_json_fields_budgeted( fields: Budgeted<BTreeMap<String, Value>>, cancellation: &CancellationToken, ) -> Result<Budgeted<Value>, JsonReadError>
Apply the ordinary JSON visitor’s private-number and tagged-object rules to decoded fields. The input reservation must cover its live entries, key capacities and nested payloads; conversion retains that allowance and moves recognized buffers.
Source§impl Value
impl Value
Sourcepub fn has_same_representation(&self, other: &Value) -> bool
pub fn has_same_representation(&self, other: &Value) -> bool
Compare retained variants and payloads without SQL coercion or normalization. Index-entry retention must distinguish signed zero, numeric scale, interval fields and nested array metadata even when the values compare equal.
Source§impl Value
impl Value
Sourcepub fn reserve_retained_payload(
&self,
budget: &MemoryBudget,
cancellation: &CancellationToken,
) -> Result<MemoryReservation, ValueRetentionError>
pub fn reserve_retained_payload( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<MemoryReservation, ValueRetentionError>
Reserve owned string/vector capacities, array headers, decimal payloads and live map entries, excluding this value’s inline layout. B-tree node slack and allocator/reference-count bookkeeping are not exposed by these carriers and are outside this payload charge. The temporary traversal stack uses the same allowance and checks cancellation without recursive calls.
Sourcepub fn reserve_retained_payload_with_check(
&self,
budget: &MemoryBudget,
check: impl FnMut() -> Result<(), QueryCancelled>,
) -> Result<MemoryReservation, ValueRetentionError>
pub fn reserve_retained_payload_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<MemoryReservation, ValueRetentionError>
Admit existing payload capacities while checking the caller’s original and invoking scopes through one callback.
Sourcepub fn retained_payload_bytes(
&self,
budget: &MemoryBudget,
cancellation: &CancellationToken,
) -> Result<usize, ValueRetentionError>
pub fn retained_payload_bytes( &self, budget: &MemoryBudget, cancellation: &CancellationToken, ) -> Result<usize, ValueRetentionError>
Count the same owned payload as reserve_retained_payload without reserving that payload again. Only the temporary traversal stack uses the supplied allowance.
Sourcepub fn retained_payload_bytes_with_check(
&self,
budget: &MemoryBudget,
check: impl FnMut() -> Result<(), QueryCancelled>,
) -> Result<usize, ValueRetentionError>
pub fn retained_payload_bytes_with_check( &self, budget: &MemoryBudget, check: impl FnMut() -> Result<(), QueryCancelled>, ) -> Result<usize, ValueRetentionError>
Count retained payload with caller-owned traversal scratch and cancellation checks. The count does not acquire a payload reservation or change the value’s existing owner.
Source§impl Value
impl Value
Sourcepub fn array_view(&self) -> Option<&ArrayValue>
pub fn array_view(&self) -> Option<&ArrayValue>
Borrow SQL array metadata, including a legacy vector’s own zero-based dimension. Array construction and row-major traversal still treat a legacy vector as one atomic element.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Value, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Value, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
impl Eq for Value
Source§impl ObserveAllocations for Value
impl ObserveAllocations for Value
fn observe_allocations<'a>( &'a self, observer: &mut AllocationObserver<'a, '_>, ) -> Result<(), ValueRetentionError>
Source§impl Ord for Value
impl Ord for Value
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Value
impl PartialOrd for Value
Source§impl Serialize for Value
impl Serialize for Value
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more