pub enum PostgresValue {
Show 21 variants
Null,
Bool(bool),
Int2(i16),
Int4(i32),
Int8(i64),
Float4(f32),
Float8(f64),
Numeric(Decimal),
Text(String),
Varchar(String),
Char(String),
Uuid(Uuid),
Timestamp(NaiveDateTime),
TimestampTz(DateTime<Utc>),
Date(NaiveDate),
Time(NaiveTime),
Json(Value),
Jsonb(Value),
Array(Vec<PostgresValue>),
Bytea(Vec<u8>),
UnchangedToast,
}Expand description
Intermediate typed value shared by bootstrap and CDC paths.
Variants§
Null
Bool(bool)
Int2(i16)
Int4(i32)
Int8(i64)
Float4(f32)
Float8(f64)
Numeric(Decimal)
Text(String)
Varchar(String)
Char(String)
Uuid(Uuid)
Timestamp(NaiveDateTime)
TimestampTz(DateTime<Utc>)
Date(NaiveDate)
Time(NaiveTime)
Json(Value)
Jsonb(Value)
Array(Vec<PostgresValue>)
Bytea(Vec<u8>)
UnchangedToast
Column present in a pgoutput tuple but value was not sent (unchanged TOAST).
Must not be mapped to ElementValue::Null; property should be omitted so
callers can preserve the previously stored value.
Implementations§
Source§impl PostgresValue
impl PostgresValue
Sourcepub fn to_json(&self) -> JsonValue
pub fn to_json(&self) -> JsonValue
Convert to JSON (lossy for temporals). Prefer [to_element_value] for Drasi paths.
Sourcepub fn to_element_value(&self) -> ElementValue
pub fn to_element_value(&self) -> ElementValue
Canonical conversion used by both bootstrap and CDC.
Mapping:
Timestamp→LocalDateTime,TimestampTz→ZonedDateTimeNumeric→Float(always, including whole numbers)Date,Time,Uuid→StringJson/Jsonb→String(compact JSON text)Bytea→String(base64 of raw bytes)Charis expected to already be trimmed by the decoder
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if this value is PostgresValue::Null.
Sourcepub fn is_unchanged_toast(&self) -> bool
pub fn is_unchanged_toast(&self) -> bool
Returns true if this is an unchanged TOAST placeholder from pgoutput (b'u').
Sourcepub fn to_key_string(&self) -> Option<String>
pub fn to_key_string(&self) -> Option<String>
Stable string form for element ID key parts.
Trait Implementations§
Source§impl Clone for PostgresValue
impl Clone for PostgresValue
Auto Trait Implementations§
impl Freeze for PostgresValue
impl RefUnwindSafe for PostgresValue
impl Send for PostgresValue
impl Sync for PostgresValue
impl Unpin for PostgresValue
impl UnsafeUnpin for PostgresValue
impl UnwindSafe for PostgresValue
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
Mutably borrows from an owned value. Read more