pub enum PgType {
}Expand description
PostgreSQL data types.
Variants§
Boolean
SmallInt
Integer
BigInt
Real
DoublePrecision
Numeric
Text
Char(u32)
VarChar(u32)
Bytea
Date
Time
TimeTz
Timestamp
TimestampTz
Interval
Uuid
Json
Jsonb
Array(Box<Self>)
Custom(String)
Implementations§
Source§impl PgType
impl PgType
Sourcepub fn from_arrow_type(dt: &DataType) -> Self
pub fn from_arrow_type(dt: &DataType) -> Self
Infer a PostgreSQL type from an Arrow data type.
Sourcepub fn to_arrow_type(&self) -> DataType
pub fn to_arrow_type(&self) -> DataType
Map this PostgreSQL type to the Arrow [DataType] a transform
engine should treat as its “seen” type for a column of this DB
type - the reverse of Self::from_arrow_type. Timestamps use
microsecond precision (Postgres’ native resolution); Numeric maps
to Decimal128(38, 9) (a wide, safe placeholder).
Sourcepub fn from_json_value(value: &Value) -> Self
pub fn from_json_value(value: &Value) -> Self
Infer a PostgreSQL type from a decoded JSON value - string sniffing
(UUID/timestamp/date/embedded-JSON detection) included.
Sourcepub fn can_widen_to(&self, other: &Self) -> bool
pub fn can_widen_to(&self, other: &Self) -> bool
Whether this type can be losslessly widened to other.
Sourcepub fn wider_type(&self, other: &Self) -> Self
pub fn wider_type(&self, other: &Self) -> Self
The wider of self and other - falls back to Jsonb for
genuinely incompatible types rather than erroring.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PgType
impl<'de> Deserialize<'de> for PgType
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PgType
impl StructuralPartialEq for PgType
Auto Trait Implementations§
impl Freeze for PgType
impl RefUnwindSafe for PgType
impl Send for PgType
impl Sync for PgType
impl Unpin for PgType
impl UnwindSafe for PgType
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