pub trait IntoDatum {
fn into_datum(self) -> Option<Datum>;
fn type_oid() -> Oid;
fn array_type_oid() -> Oid { ... }
}
Expand description
Convert a Rust type into a pg_sys::Datum
.
Default implementations are provided for the common Rust types.
If implementing this, also implement FromDatum
for the reverse
conversion.
Note that any conversions that need to allocate memory (ie, for a varlena *
representation
of a Rust type, that memory must be allocated within a PgMemoryContexts
.
Required Methods
Provided Methods
fn array_type_oid() -> Oid
Implementations on Foreign Types
sourceimpl<T> IntoDatum for Option<T> where
T: IntoDatum,
impl<T> IntoDatum for Option<T> where
T: IntoDatum,
for supporting NULL as the None value of an Option
sourceimpl IntoDatum for ItemPointerData
impl IntoDatum for ItemPointerData
sourceimpl<A, B, C> IntoDatum for (Option<A>, Option<B>, Option<C>) where
A: IntoDatum,
B: IntoDatum,
C: IntoDatum,
impl<A, B, C> IntoDatum for (Option<A>, Option<B>, Option<C>) where
A: IntoDatum,
B: IntoDatum,
C: IntoDatum,
Implementors
impl IntoDatum for PgOid
impl IntoDatum for PgRelation
impl IntoDatum for AnyArray
impl IntoDatum for AnyElement
impl IntoDatum for Date
impl IntoDatum for Inet
impl IntoDatum for Internal
impl IntoDatum for Json
for json
impl IntoDatum for JsonB
for jsonb
impl IntoDatum for JsonString
for jsonstring
impl IntoDatum for Numeric
impl IntoDatum for Time
impl IntoDatum for TimeWithTimeZone
impl IntoDatum for Timestamp
impl IntoDatum for TimestampWithTimeZone
impl IntoDatum for Uuid
impl<T> IntoDatum for PgVarlena<T> where
T: Copy + Sized,
impl<T> IntoDatum for T where
T: PostgresType + Serialize,
impl<T, AllocatedBy: WhoAllocated<T>> IntoDatum for PgBox<T, AllocatedBy>
for user types