Struct ormlite::postgres::PgTypeInfo
pub struct PgTypeInfo(/* private fields */);postgres only.Expand description
Type information for a PostgreSQL type.
Implementations§
§impl PgTypeInfo
impl PgTypeInfo
pub fn kind(&self) -> &PgTypeKind
pub fn kind(&self) -> &PgTypeKind
Returns the kind (simple, array, enum, etc.) for this type.
pub 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.
pub 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.
pub 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§
§impl Clone for PgTypeInfo
impl Clone for PgTypeInfo
§fn clone(&self) -> PgTypeInfo
fn clone(&self) -> PgTypeInfo
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PgTypeInfo
impl Debug for PgTypeInfo
§impl Deref for PgTypeInfo
impl Deref for PgTypeInfo
§impl Display for PgTypeInfo
impl Display for PgTypeInfo
§impl PartialEq for PgTypeInfo
impl PartialEq for PgTypeInfo
§fn eq(&self, other: &PgTypeInfo) -> bool
fn eq(&self, other: &PgTypeInfo) -> bool
self and other values to be equal, and is used
by ==.§impl<'a> TryFrom<&'a PgTypeInfo> for AnyTypeInfo
impl<'a> TryFrom<&'a PgTypeInfo> for AnyTypeInfo
§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>
§impl TypeInfo for PgTypeInfo
impl TypeInfo for PgTypeInfo
§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.