pub struct PgTypeInfo(/* private fields */);postgres only.Expand description
Type information for a PostgreSQL type.
Implementationsยง
Sourceยงimpl PgTypeInfo
impl PgTypeInfo
Sourcepub fn kind(&self) -> &PgTypeKind
pub fn kind(&self) -> &PgTypeKind
Returns the kind (simple, array, enum, etc.) for this type.
Sourcepub fn oid(&self) -> Option<Oid>
pub fn oid(&self) -> Option<Oid>
Returns the OID for this type, if available.
The OID may not be available if SQLx only knows the type by name.
It will have to be resolved by a PgConnection at runtime which
will yield a new and semantically distinct TypeInfo instance.
This method does not perform any such lookup.
ยงNote
With the exception of the default pg_type catalog, type OIDs are not stable in PostgreSQL.
If a type is added by an extension, its OID will be assigned when the CREATE EXTENSION statement is executed,
and so can change depending on what extensions are installed and in what order, as well as the exact
version of PostgreSQL.
Sourcepub const fn with_name(name: &'static str) -> PgTypeInfo
pub const fn with_name(name: &'static str) -> PgTypeInfo
Create a PgTypeInfo from a type name.
The OID for the type will be fetched from Postgres on use of a value of this type. The fetched OID will be cached per-connection.
Sourcepub const fn with_oid(oid: Oid) -> PgTypeInfo
pub const fn with_oid(oid: Oid) -> PgTypeInfo
Create a PgTypeInfo from an OID.
Note that the OID for a type is very dependent on the environment. If you only ever use
one database or if this is an unhandled built-in type, you should be fine. Otherwise,
you will be better served using with_name.
Trait Implementationsยง
Sourceยงimpl Clone for PgTypeInfo
impl Clone for PgTypeInfo
Sourceยงfn clone(&self) -> PgTypeInfo
fn clone(&self) -> PgTypeInfo
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 PgTypeInfo
impl Debug for PgTypeInfo
Sourceยงimpl Deref for PgTypeInfo
impl Deref for PgTypeInfo
Sourceยงimpl Display for PgTypeInfo
impl Display for PgTypeInfo
Sourceยงimpl PartialEq for PgTypeInfo
impl PartialEq for PgTypeInfo
Sourceยงfn eq(&self, other: &PgTypeInfo) -> bool
fn eq(&self, other: &PgTypeInfo) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PgTypeInfo
Sourceยงimpl<'a> TryFrom<&'a PgTypeInfo> for AnyTypeInfo
impl<'a> TryFrom<&'a PgTypeInfo> for AnyTypeInfo
Sourceยงfn try_from(
pg_type: &'a PgTypeInfo,
) -> Result<AnyTypeInfo, <AnyTypeInfo as TryFrom<&'a PgTypeInfo>>::Error>
fn try_from( pg_type: &'a PgTypeInfo, ) -> Result<AnyTypeInfo, <AnyTypeInfo as TryFrom<&'a PgTypeInfo>>::Error>
Sourceยงimpl TypeInfo for PgTypeInfo
impl TypeInfo for PgTypeInfo
Sourceยงfn name(&self) -> &str
fn name(&self) -> &str
VARCHAR, TEXT, or INT. Type names should be uppercase. They
should be a rough approximation of how they are written in SQL in the given database.fn is_null(&self) -> bool
Auto Trait Implementationsยง
impl Freeze for PgTypeInfo
impl RefUnwindSafe for PgTypeInfo
impl Send for PgTypeInfo
impl Sync for PgTypeInfo
impl Unpin for PgTypeInfo
impl UnsafeUnpin for PgTypeInfo
impl UnwindSafe for PgTypeInfo
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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