Skip to main content

PgType

Struct PgType 

Source
pub struct PgType<'a> {
Show 20 fields pub oid: u32, pub typname: &'a str, pub regtype: &'a str, pub typnamespace: u32, pub typowner: u32, pub typlen: i16, pub typbyval: bool, pub typtype: &'a str, pub typcategory: &'a str, pub typisprefered: bool, pub typisdefined: bool, pub typrelid: u32, pub typsubscript: &'static str, pub typelem: u32, pub typarray: u32, pub typalign: &'static str, pub typstorage: &'static str, pub typbasetype: u32, pub typreceive: &'static str, pub typreceive_oid: u32,
}
Expand description

A Postgres type. Similar structure as pg_catalog.pg_type. https://www.postgresql.org/docs/14/catalog-pg-type.html

Fields§

§oid: u32§typname: &'a str

Data type name

§regtype: &'a str§typnamespace: u32

The OID of the namespace that contains this type. references pg_namespace.oid

§typowner: u32

Owner of the type. references pg_authid.oid

§typlen: i16

For a fixed-size type, typlen is the number of bytes in the internal representation of the type. But for a variable-length type, typlen is negative. -1 indicates a “varlena” type (one that has a length word), -2 indicates a null-terminated C string.

§typbyval: bool§typtype: &'a str§typcategory: &'a str§typisprefered: bool§typisdefined: bool§typrelid: u32§typsubscript: &'static str§typelem: u32§typarray: u32§typalign: &'static str§typstorage: &'static str§typbasetype: u32§typreceive: &'static str§typreceive_oid: u32

Implementations§

Source§

impl PgType<'_>

Source

pub fn get_typinput(&self) -> String

Source

pub const fn is_binary_supported(&self) -> bool

Source§

impl<'a> PgType<'a>

Source

pub const fn get_by_tid(oid: PgTypeId) -> &'static PgType<'static>

Source

pub const fn get_all() -> &'static [&'static PgType<'static>]

Trait Implementations§

Source§

impl<'a> Debug for PgType<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PgType<'a>

§

impl<'a> RefUnwindSafe for PgType<'a>

§

impl<'a> Send for PgType<'a>

§

impl<'a> Sync for PgType<'a>

§

impl<'a> Unpin for PgType<'a>

§

impl<'a> UnsafeUnpin for PgType<'a>

§

impl<'a> UnwindSafe for PgType<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.