pub enum DecodedValue {
Show 17 variants
Null,
Bool(bool),
I64(i64),
F64(f64),
Str(String),
Bytes(Vec<u8>),
Uuid([u8; 16]),
Decimal(String),
Interval {
months: i32,
days: i32,
microseconds: i64,
},
Date(i32),
Time(i64),
Timestamp(i64),
Timestamptz(i64),
Array(Vec<DecodedValue>),
Composite(Vec<DecodedValue>),
Object(Vec<(String, DecodedValue)>),
Range {
lower: Option<Box<DecodedValue>>,
upper: Option<Box<DecodedValue>>,
inc_lower: bool,
inc_upper: bool,
empty: bool,
},
}Variants§
Null
Bool(bool)
I64(i64)
F64(f64)
Str(String)
Bytes(Vec<u8>)
Uuid([u8; 16])
Raw 16-byte UUID, matching QueryParam::Uuid’s own convention in
pylon-core. Stored as raw bytes rather than a uuid::Uuid field
(every consuming crate already re-wraps this in its own richer type
on the way out — e.g. pylon-client’s Value::Uuid(uuid::Uuid) —
so there’s no benefit to carrying that type this deep); uuid is
still a dependency of this crate, purely so From<uuid::Uuid> below
can convert into this variant without every caller writing
.into_bytes() by hand.
Decimal(String)
Arbitrary-precision decimal, stored as its canonical string form
(matches how _pg_decode_numeric round-trips today) rather than a
lossy f64 or a bespoke bignum encoding.
Interval
A PostgreSQL interval — backs both Pylon’s std::duration (months
always 0 by convention) and cal::relative_duration (months may be
nonzero). Kept as the three raw wire components rather than folded
into a single duration, since months (a calendar-relative unit —
“1 month” isn’t a fixed number of days) can’t be losslessly combined
with days/microseconds without a reference date.
Date(i32)
PostgreSQL date — whole days since the PG epoch (2000-01-01),
exactly as the wire encodes it. Backs cal::local_date.
Time(i64)
PostgreSQL time (no timezone) — microseconds since midnight,
exactly as the wire encodes it. Backs cal::local_time.
Timestamp(i64)
PostgreSQL timestamp (no timezone) — microseconds since the PG
epoch (2000-01-01T00:00:00), exactly as the wire encodes it. Backs
cal::local_datetime; decodes to a naive datetime.datetime.
Timestamptz(i64)
PostgreSQL timestamptz — microseconds since the PG epoch
(2000-01-01T00:00:00 UTC; PostgreSQL always normalizes timestamptz
to UTC on the wire, regardless of session timezone), exactly as the
wire encodes it. Backs std::datetime; decodes to a UTC-aware
datetime.datetime. A distinct variant from Timestamp (not a
shared representation with a tag) so decode/encode can’t mix up
naive vs. aware at the type level.
Array(Vec<DecodedValue>)
A genuine Postgres array (text[], int8[], …) — reconstructed
Python-side as a list, matching what has always decoded a
Postgres array into. Do not use this for a composite/record’s
positional fields; see Composite.
Composite(Vec<DecodedValue>)
A positional composite (record — a schema object’s own field
tuple, or a nested ROW(...)), reconstructed Python-side as a
tuple, matching a record row’s own behavior — critically,
isinstance(a_tuple, (dict, list)) is False, the same as a real
a record row, which pylon.query._decode()’s "named_tuple"
case relies on to tell “this position holds a raw jsonb value”
apart from “this position holds a composite that needs value[pos]
indexing first.” Using Array (→ list) here instead silently
breaks that check — a real bug caught by comparing decoded output
against the live driver path on real queries.
Object(Vec<(String, DecodedValue)>)
Field name + value pairs, in shape order (not a map — field order is
part of what ShapeNode positions describe, and duplicate names
can’t happen for a single object’s own pointers).
Range
A PostgreSQL range value (int8range, numrange, tsrange,
tstzrange, daterange, …). lower/upper are None for an
unbounded side; empty == true means the whole range is empty
(lower/upper are meaningless in that case, not “both unbounded” —
PostgreSQL’s own binary encoding distinguishes the two). A
multirange<T> decodes to a plain Array of these, not a separate
variant — it’s just an ordered collection of ranges.
Trait Implementations§
Source§impl Archive for DecodedValue
impl Archive for DecodedValue
Source§type Archived = ArchivedDecodedValue
type Archived = ArchivedDecodedValue
Source§type Resolver = DecodedValueResolver
type Resolver = DecodedValueResolver
Source§fn resolve(
&self,
resolver: <DecodedValue as Archive>::Resolver,
out: Place<<DecodedValue as Archive>::Archived>,
)
fn resolve( &self, resolver: <DecodedValue as Archive>::Resolver, out: Place<<DecodedValue as Archive>::Archived>, )
Source§const COPY_OPTIMIZATION: CopyOptimization<Self> = _
const COPY_OPTIMIZATION: CopyOptimization<Self> = _
serialize. Read moreSource§impl Clone for DecodedValue
impl Clone for DecodedValue
Source§fn clone(&self) -> DecodedValue
fn clone(&self) -> DecodedValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodedValue
impl Debug for DecodedValue
Source§impl<__D> Deserialize<DecodedValue, __D> for <DecodedValue as Archive>::Archivedwhere
__D: Fallible + ?Sized,
<__D as Fallible>::Error: Source,
bool: Archive,
<bool as Archive>::Archived: Deserialize<bool, __D>,
i64: Archive,
<i64 as Archive>::Archived: Deserialize<i64, __D>,
f64: Archive,
<f64 as Archive>::Archived: Deserialize<f64, __D>,
String: Archive,
<String as Archive>::Archived: Deserialize<String, __D>,
Vec<u8>: Archive,
<Vec<u8> as Archive>::Archived: Deserialize<Vec<u8>, __D>,
[u8; 16]: Archive,
<[u8; 16] as Archive>::Archived: Deserialize<[u8; 16], __D>,
i32: Archive,
<i32 as Archive>::Archived: Deserialize<i32, __D>,
impl<__D> Deserialize<DecodedValue, __D> for <DecodedValue as Archive>::Archivedwhere
__D: Fallible + ?Sized,
<__D as Fallible>::Error: Source,
bool: Archive,
<bool as Archive>::Archived: Deserialize<bool, __D>,
i64: Archive,
<i64 as Archive>::Archived: Deserialize<i64, __D>,
f64: Archive,
<f64 as Archive>::Archived: Deserialize<f64, __D>,
String: Archive,
<String as Archive>::Archived: Deserialize<String, __D>,
Vec<u8>: Archive,
<Vec<u8> as Archive>::Archived: Deserialize<Vec<u8>, __D>,
[u8; 16]: Archive,
<[u8; 16] as Archive>::Archived: Deserialize<[u8; 16], __D>,
i32: Archive,
<i32 as Archive>::Archived: Deserialize<i32, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<DecodedValue, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<DecodedValue, <__D as Fallible>::Error>
Source§impl From<&str> for DecodedValue
impl From<&str> for DecodedValue
Source§fn from(value: &str) -> DecodedValue
fn from(value: &str) -> DecodedValue
Source§impl From<String> for DecodedValue
impl From<String> for DecodedValue
Source§fn from(value: String) -> DecodedValue
fn from(value: String) -> DecodedValue
Source§impl From<Uuid> for DecodedValue
impl From<Uuid> for DecodedValue
Source§fn from(value: Uuid) -> DecodedValue
fn from(value: Uuid) -> DecodedValue
Source§impl From<bool> for DecodedValue
impl From<bool> for DecodedValue
Source§fn from(value: bool) -> DecodedValue
fn from(value: bool) -> DecodedValue
Source§impl From<f32> for DecodedValue
impl From<f32> for DecodedValue
Source§fn from(value: f32) -> DecodedValue
fn from(value: f32) -> DecodedValue
Source§impl From<f64> for DecodedValue
impl From<f64> for DecodedValue
Source§fn from(value: f64) -> DecodedValue
fn from(value: f64) -> DecodedValue
Source§impl From<i16> for DecodedValue
impl From<i16> for DecodedValue
Source§fn from(value: i16) -> DecodedValue
fn from(value: i16) -> DecodedValue
Source§impl From<i32> for DecodedValue
impl From<i32> for DecodedValue
Source§fn from(value: i32) -> DecodedValue
fn from(value: i32) -> DecodedValue
Source§impl From<i64> for DecodedValue
impl From<i64> for DecodedValue
Source§fn from(value: i64) -> DecodedValue
fn from(value: i64) -> DecodedValue
Source§impl PartialEq for DecodedValue
impl PartialEq for DecodedValue
Source§impl PartialEq<ArchivedDecodedValue> for DecodedValuewhere
bool: Archive,
i64: Archive,
f64: Archive,
String: Archive,
Vec<u8>: Archive,
[u8; 16]: Archive,
i32: Archive,
<bool as Archive>::Archived: PartialEq<bool>,
<i64 as Archive>::Archived: PartialEq<i64>,
<f64 as Archive>::Archived: PartialEq<f64>,
<String as Archive>::Archived: PartialEq<String>,
<Vec<u8> as Archive>::Archived: PartialEq<Vec<u8>>,
<[u8; 16] as Archive>::Archived: PartialEq<[u8; 16]>,
<i32 as Archive>::Archived: PartialEq<i32>,
impl PartialEq<ArchivedDecodedValue> for DecodedValuewhere
bool: Archive,
i64: Archive,
f64: Archive,
String: Archive,
Vec<u8>: Archive,
[u8; 16]: Archive,
i32: Archive,
<bool as Archive>::Archived: PartialEq<bool>,
<i64 as Archive>::Archived: PartialEq<i64>,
<f64 as Archive>::Archived: PartialEq<f64>,
<String as Archive>::Archived: PartialEq<String>,
<Vec<u8> as Archive>::Archived: PartialEq<Vec<u8>>,
<[u8; 16] as Archive>::Archived: PartialEq<[u8; 16]>,
<i32 as Archive>::Archived: PartialEq<i32>,
Source§impl<__S> Serialize<__S> for DecodedValue
impl<__S> Serialize<__S> for DecodedValue
impl StructuralPartialEq for DecodedValue
Auto Trait Implementations§
impl Freeze for DecodedValue
impl RefUnwindSafe for DecodedValue
impl Send for DecodedValue
impl Sync for DecodedValue
impl Unpin for DecodedValue
impl UnsafeUnpin for DecodedValue
impl UnwindSafe for DecodedValue
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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,
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.