Skip to main content

BuiltinType

Enum BuiltinType 

Source
pub enum BuiltinType {
Show 198 variants Boolean, Bytea, InternalChar, Name, Bigint, Smallint, Int2Vector, Integer, Regproc, Text, Oid, Tid, Xid, Cid, Oidvector, PgDdlCommand, PgType, PgAttribute, PgProc, PgClass, Json, Xml, XmlArray, PgNodeTree, JsonArray, PgTypeArray, TableAmHandler, PgAttributeArray, Xid8Array, PgProcArray, PgClassArray, IndexAmHandler, Point, Lseg, Path, Box, Polygon, Line, LineArray, Cidr, CidrArray, Real, DoublePrecision, Unknown, Circle, CircleArray, Macaddr8, Macaddr8Array, Money, MoneyArray, Macaddr, Inet, BooleanArray, ByteaArray, InternalCharArray, NameArray, SmallintArray, Int2VectorArray, IntegerArray, RegprocArray, TextArray, TidArray, XidArray, CidArray, OidvectorArray, BigintArray, PointArray, LsegArray, PathArray, BoxArray, RealArray, DoublePrecisionArray, PolygonArray, OidArray, Aclitem, AclitemArray, MacaddrArray, InetArray, Date, DateArray, PgDatabase, CstringArray, Refcursor, RefcursorArray, Regprocedure, Regoper, Regoperator, Regclass, Regtype, RegprocedureArray, RegoperArray, RegoperatorArray, RegclassArray, RegtypeArray, Record, Cstring, Any, Anyarray, Void, Trigger, LanguageHandler, Internal, Anyelement, RecordArray, Anynonarray, PgAuthid, PgAuthMembers, TxidSnapshotArray, Uuid, UuidArray, TxidSnapshot, FdwHandler, PgLsn, PgLsnArray, TsmHandler, PgNdistinct, PgDependencies, Anyenum, Tsvector, Tsquery, Gtsvector, TsvectorArray, GtsvectorArray, TsqueryArray, Regconfig, RegconfigArray, Regdictionary, RegdictionaryArray, Jsonb, JsonbArray, Anyrange, EventTrigger, Int4Range, Int4RangeArray, Numrange, NumrangeArray, Tsrange, TsrangeArray, Tstzrange, TstzrangeArray, Daterange, DaterangeArray, Int8Range, Int8RangeArray, PgShseclabel, Jsonpath, JsonpathArray, Regnamespace, RegnamespaceArray, Regrole, RegroleArray, Regcollation, RegcollationArray, Int4Multirange, Nummultirange, Tsmultirange, Tstzmultirange, Datemultirange, Int8Multirange, Anymultirange, Anycompatiblemultirange, PgBrinBloomSummary, PgBrinMinmaxMultiSummary, PgMcvList, PgSnapshot, PgSnapshotArray, Xid8, Anycompatible, Anycompatiblearray, Anycompatiblenonarray, Anycompatiblerange, PgSubscription, Int4MultirangeArray, NummultirangeArray, TsmultirangeArray, TstzmultirangeArray, DatemultirangeArray, Int8MultirangeArray, BpcharArray(Option<CharLength>), VarcharArray(Option<CharLength>), Bpchar(Option<CharLength>), Varchar(Option<CharLength>), Time(Option<TimePrecision>), Timestamp(Option<TimePrecision>), TimestampArray(Option<TimePrecision>), TimeArray(Option<TimePrecision>), TimestampTz(Option<TimePrecision>), TimestampTzArray(Option<TimePrecision>), Interval(IntervalTypmod), IntervalArray(IntervalTypmod), NumericArray(Option<NumericTypmod>), TimeTz(Option<TimePrecision>), TimeTzArray(Option<TimePrecision>), Bit(Option<BitLength>), BitArray(Option<BitLength>), Varbit(Option<BitLength>), VarbitArray(Option<BitLength>), Numeric(Option<NumericTypmod>),
}
Expand description

A fixed PostgreSQL built-in type identity with its type modifier.

Variants§

§

Boolean

bool.

§

Bytea

bytea.

§

InternalChar

char.

§

Name

name.

§

Bigint

int8.

§

Smallint

int2.

§

Int2Vector

int2vector.

§

Integer

int4.

§

Regproc

regproc.

§

Text

text.

§

Oid

oid.

§

Tid

tid.

§

Xid

xid.

§

Cid

cid.

§

Oidvector

oidvector.

§

PgDdlCommand

pg_ddl_command.

§

PgType

pg_type.

§

PgAttribute

pg_attribute.

§

PgProc

pg_proc.

§

PgClass

pg_class.

§

Json

json.

§

Xml

xml.

§

XmlArray

_xml.

§

PgNodeTree

pg_node_tree.

§

JsonArray

_json.

§

PgTypeArray

_pg_type.

§

TableAmHandler

table_am_handler.

§

PgAttributeArray

_pg_attribute.

§

Xid8Array

_xid8.

§

PgProcArray

_pg_proc.

§

PgClassArray

_pg_class.

§

IndexAmHandler

index_am_handler.

§

Point

point.

§

Lseg

lseg.

§

Path

path.

§

Box

box.

§

Polygon

polygon.

§

Line

line.

§

LineArray

_line.

§

Cidr

cidr.

§

CidrArray

_cidr.

§

Real

float4.

§

DoublePrecision

float8.

§

Unknown

unknown.

§

Circle

circle.

§

CircleArray

_circle.

§

Macaddr8

macaddr8.

§

Macaddr8Array

_macaddr8.

§

Money

money.

§

MoneyArray

_money.

§

Macaddr

macaddr.

§

Inet

inet.

§

BooleanArray

_bool.

§

ByteaArray

_bytea.

§

InternalCharArray

_char.

§

NameArray

_name.

§

SmallintArray

_int2.

§

Int2VectorArray

_int2vector.

§

IntegerArray

_int4.

§

RegprocArray

_regproc.

§

TextArray

_text.

§

TidArray

_tid.

§

XidArray

_xid.

§

CidArray

_cid.

§

OidvectorArray

_oidvector.

§

BigintArray

_int8.

§

PointArray

_point.

§

LsegArray

_lseg.

§

PathArray

_path.

§

BoxArray

_box.

§

RealArray

_float4.

§

DoublePrecisionArray

_float8.

§

PolygonArray

_polygon.

§

OidArray

_oid.

§

Aclitem

aclitem.

§

AclitemArray

_aclitem.

§

MacaddrArray

_macaddr.

§

InetArray

_inet.

§

Date

date.

§

DateArray

_date.

§

PgDatabase

pg_database.

§

CstringArray

_cstring.

§

Refcursor

refcursor.

§

RefcursorArray

_refcursor.

§

Regprocedure

regprocedure.

§

Regoper

regoper.

§

Regoperator

regoperator.

§

Regclass

regclass.

§

Regtype

regtype.

§

RegprocedureArray

_regprocedure.

§

RegoperArray

_regoper.

§

RegoperatorArray

_regoperator.

§

RegclassArray

_regclass.

§

RegtypeArray

_regtype.

§

Record

record.

§

Cstring

cstring.

§

Any

any.

§

Anyarray

anyarray.

§

Void

void.

§

Trigger

trigger.

§

LanguageHandler

language_handler.

§

Internal

internal.

§

Anyelement

anyelement.

§

RecordArray

_record.

§

Anynonarray

anynonarray.

§

PgAuthid

pg_authid.

§

PgAuthMembers

pg_auth_members.

§

TxidSnapshotArray

_txid_snapshot.

§

Uuid

uuid.

§

UuidArray

_uuid.

§

TxidSnapshot

txid_snapshot.

§

FdwHandler

fdw_handler.

§

PgLsn

pg_lsn.

§

PgLsnArray

_pg_lsn.

§

TsmHandler

tsm_handler.

§

PgNdistinct

pg_ndistinct.

§

PgDependencies

pg_dependencies.

§

Anyenum

anyenum.

§

Tsvector

tsvector.

§

Tsquery

tsquery.

§

Gtsvector

gtsvector.

§

TsvectorArray

_tsvector.

§

GtsvectorArray

_gtsvector.

§

TsqueryArray

_tsquery.

§

Regconfig

regconfig.

§

RegconfigArray

_regconfig.

§

Regdictionary

regdictionary.

§

RegdictionaryArray

_regdictionary.

§

Jsonb

jsonb.

§

JsonbArray

_jsonb.

§

Anyrange

anyrange.

§

EventTrigger

event_trigger.

§

Int4Range

int4range.

§

Int4RangeArray

_int4range.

§

Numrange

numrange.

§

NumrangeArray

_numrange.

§

Tsrange

tsrange.

§

TsrangeArray

_tsrange.

§

Tstzrange

tstzrange.

§

TstzrangeArray

_tstzrange.

§

Daterange

daterange.

§

DaterangeArray

_daterange.

§

Int8Range

int8range.

§

Int8RangeArray

_int8range.

§

PgShseclabel

pg_shseclabel.

§

Jsonpath

jsonpath.

§

JsonpathArray

_jsonpath.

§

Regnamespace

regnamespace.

§

RegnamespaceArray

_regnamespace.

§

Regrole

regrole.

§

RegroleArray

_regrole.

§

Regcollation

regcollation.

§

RegcollationArray

_regcollation.

§

Int4Multirange

int4multirange.

§

Nummultirange

nummultirange.

§

Tsmultirange

tsmultirange.

§

Tstzmultirange

tstzmultirange.

§

Datemultirange

datemultirange.

§

Int8Multirange

int8multirange.

§

Anymultirange

anymultirange.

§

Anycompatiblemultirange

anycompatiblemultirange.

§

PgBrinBloomSummary

pg_brin_bloom_summary.

§

PgBrinMinmaxMultiSummary

pg_brin_minmax_multi_summary.

§

PgMcvList

pg_mcv_list.

§

PgSnapshot

pg_snapshot.

§

PgSnapshotArray

_pg_snapshot.

§

Xid8

xid8.

§

Anycompatible

anycompatible.

§

Anycompatiblearray

anycompatiblearray.

§

Anycompatiblenonarray

anycompatiblenonarray.

§

Anycompatiblerange

anycompatiblerange.

§

PgSubscription

pg_subscription.

§

Int4MultirangeArray

_int4multirange.

§

NummultirangeArray

_nummultirange.

§

TsmultirangeArray

_tsmultirange.

§

TstzmultirangeArray

_tstzmultirange.

§

DatemultirangeArray

_datemultirange.

§

Int8MultirangeArray

_int8multirange.

§

BpcharArray(Option<CharLength>)

_bpchar with its modifier.

§

VarcharArray(Option<CharLength>)

_varchar with its modifier.

§

Bpchar(Option<CharLength>)

bpchar with its modifier.

§

Varchar(Option<CharLength>)

varchar with its modifier.

§

Time(Option<TimePrecision>)

time with its modifier.

§

Timestamp(Option<TimePrecision>)

timestamp with its modifier.

§

TimestampArray(Option<TimePrecision>)

_timestamp with its modifier.

§

TimeArray(Option<TimePrecision>)

_time with its modifier.

§

TimestampTz(Option<TimePrecision>)

timestamptz with its modifier.

§

TimestampTzArray(Option<TimePrecision>)

_timestamptz with its modifier.

§

Interval(IntervalTypmod)

interval with its modifier.

§

IntervalArray(IntervalTypmod)

_interval with its modifier.

§

NumericArray(Option<NumericTypmod>)

_numeric with its modifier.

§

TimeTz(Option<TimePrecision>)

timetz with its modifier.

§

TimeTzArray(Option<TimePrecision>)

_timetz with its modifier.

§

Bit(Option<BitLength>)

bit with its modifier.

§

BitArray(Option<BitLength>)

_bit with its modifier.

§

Varbit(Option<BitLength>)

varbit with its modifier.

§

VarbitArray(Option<BitLength>)

_varbit with its modifier.

§

Numeric(Option<NumericTypmod>)

numeric with its modifier.

Implementations§

Source§

impl BuiltinType

Source

pub const ALL: &'static [Self]

Excludes identities assigned by initdb rather than fixed by PostgreSQL.

Source

pub const fn oid(self) -> u32

The built-in object identifier.

Source

pub const fn from_oid(oid: u32) -> Option<Self>

The built-in identity for a fixed object identifier, without a modifier.

Source

pub const fn catalog_name(self) -> &'static str

The pg_type.typname of this identity.

Source

pub fn from_catalog_name(name: &str) -> Option<Self>

The built-in identity whose pg_type.typname is name, without a modifier.

Source

pub const fn diagnostic_name(self) -> &'static str

The spelling format_type(oid, NULL) uses in diagnostics.

Source

pub const fn pg_type(self) -> Self

This identity without its modifier.

Source§

impl BuiltinType

Source

pub const fn collation(self) -> Option<TypeCollation>

The type’s pg_type.typcollation, independent of its modifier.

use sql_values::postgres::{BuiltinType, TypeCollation};

assert_eq!(BuiltinType::Text.collation(), Some(TypeCollation::Default));
assert_eq!(BuiltinType::Name.collation(), Some(TypeCollation::C));
assert_eq!(BuiltinType::Integer.collation(), None);
Source§

impl BuiltinType

Source

pub fn typmod(self) -> i32

The catalog modifier passed to format_type, or -1 when absent.

Source

pub fn with_typmod(self, typmod: i32) -> Option<Self>

Replaces the modifier with a valid PostgreSQL catalog typmod, clearing it for -1.

use sql_values::postgres::{BuiltinType, CharLength};

let varchar = BuiltinType::Varchar(CharLength::new(10));
assert_eq!(BuiltinType::Varchar(None).with_typmod(14), Some(varchar));
assert_eq!(varchar.with_typmod(-1), Some(BuiltinType::Varchar(None)));
assert_eq!(BuiltinType::Time(None).with_typmod(7), None);
assert_eq!(BuiltinType::Boolean.with_typmod(0), None);

Trait Implementations§

Source§

impl Clone for BuiltinType

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BuiltinType

Source§

impl Debug for BuiltinType

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for BuiltinType

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BuiltinType

Source§

impl From<IntegerType> for BuiltinType

Source§

fn from(integer: IntegerType) -> Self

Converts to this type from the input type.
Source§

impl Hash for BuiltinType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BuiltinType

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuiltinType

Source§

impl TryFrom<BuiltinType> for IntegerType

Refuses a type that is not an integer type, returning it.

Source§

type Error = BuiltinType

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

fn try_from(pg_type: BuiltinType) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.