Documentation
¶
Index ¶
- Constants
- func RegisterAll(ctx context.Context, conn *pgx.Conn) ([]*Type, error)
- func RegisterDefaultPgTypeVariants(tMap *Map)
- func RegisterTypes(ctx context.Context, conn *pgx.Conn) ([]*Type, error)
- type Int16
- func (n Int16) Int64Value() (Int8, error)
- func (src Int16) MarshalJSON() ([]byte, error)
- func (dst *Int16) Scan(src any) error
- func (dst *Int16) ScanInt64(n Int8) error
- func (dst *Int16) ScanUint64(n UInt8) error
- func (n Int16) Uint64Value() (UInt8, error)
- func (dst *Int16) UnmarshalJSON(b []byte) error
- func (src Int16) Value() (driver.Value, error)
- type Int16Codec
- func (c Int16Codec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c Int16Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error)
- func (Int16Codec) FormatSupported(format int16) bool
- func (Int16Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
- func (Int16Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
- func (Int16Codec) PreferredFormat() int16
- type UInt16
- func (n UInt16) Int64Value() (Int8, error)
- func (src UInt16) MarshalJSON() ([]byte, error)
- func (dst *UInt16) Scan(src any) error
- func (dst *UInt16) ScanInt64(n Int8) error
- func (dst *UInt16) ScanUint64(n UInt8) error
- func (n UInt16) Uint64Value() (UInt8, error)
- func (dst *UInt16) UnmarshalJSON(b []byte) error
- func (src UInt16) Value() (driver.Value, error)
- type UInt16Codec
- func (c UInt16Codec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c UInt16Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error)
- func (UInt16Codec) FormatSupported(format int16) bool
- func (UInt16Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
- func (UInt16Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
- func (UInt16Codec) PreferredFormat() int16
- type UInt2
- func (n UInt2) Int64Value() (Int8, error)
- func (src UInt2) MarshalJSON() ([]byte, error)
- func (dst *UInt2) Scan(src any) error
- func (dst *UInt2) ScanInt64(n Int8) error
- func (dst *UInt2) ScanUint64(n UInt8) error
- func (n UInt2) Uint64Value() (UInt8, error)
- func (dst *UInt2) UnmarshalJSON(b []byte) error
- func (src UInt2) Value() (driver.Value, error)
- type UInt2Codec
- func (c UInt2Codec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c UInt2Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error)
- func (UInt2Codec) FormatSupported(format int16) bool
- func (UInt2Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
- func (UInt2Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
- func (UInt2Codec) PreferredFormat() int16
- type UInt4
- func (n UInt4) Int64Value() (Int8, error)
- func (src UInt4) MarshalJSON() ([]byte, error)
- func (dst *UInt4) Scan(src any) error
- func (dst *UInt4) ScanInt64(n Int8) error
- func (dst *UInt4) ScanUint64(n UInt8) error
- func (n UInt4) Uint64Value() (UInt8, error)
- func (dst *UInt4) UnmarshalJSON(b []byte) error
- func (src UInt4) Value() (driver.Value, error)
- type UInt4Codec
- func (c UInt4Codec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c UInt4Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error)
- func (UInt4Codec) FormatSupported(format int16) bool
- func (UInt4Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
- func (UInt4Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
- func (UInt4Codec) PreferredFormat() int16
- type UInt8
- func (n UInt8) Int64Value() (Int8, error)
- func (src UInt8) MarshalJSON() ([]byte, error)
- func (dst *UInt8) Scan(src any) error
- func (dst *UInt8) ScanInt64(n Int8) error
- func (dst *UInt8) ScanUint64(n UInt8) error
- func (n UInt8) Uint64Value() (UInt8, error)
- func (dst *UInt8) UnmarshalJSON(b []byte) error
- func (src UInt8) Value() (driver.Value, error)
- type UInt8Codec
- func (c UInt8Codec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error)
- func (c UInt8Codec) DecodeValue(m *Map, oid uint32, format int16, src []byte) (any, error)
- func (UInt8Codec) FormatSupported(format int16) bool
- func (UInt8Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
- func (UInt8Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
- func (UInt8Codec) PreferredFormat() int16
- type Uint64Scanner
- type Uint64Valuer
Constants ¶
const ( Uint2TypName = "uint2" Uint4TypName = "uint4" Uint8TypName = "uint8" Uint16TypName = "uint16" Int16TypName = "int16" )
Variables ¶
This section is empty.
Functions ¶
func RegisterAll ¶
RegisterAll registers both integer types and their associated variants.
This function invokes RegisterTypes to register the main integer types (uint2, uint4, uint8, uint16 and int16) and subsequently registers their variants (array, range, multirange) in the TypeMap of pgx.Conn by calling RegisterDefaultPgTypeVariants.
It returns a slice of pointers to the registered Type structs. If an error occurs during the registration process, it returns nil along with the error.
The returned types can be used to register them on new connections without issuing actual database queries. For example, you can use the following code:
conn.TypeMap().RegisterTypes(regTypes) types.RegisterDefaultPgTypeVariants(conn.TypeMap())
Note that the uniqueness of type OIDs is guaranteed only within a single server and a single database on that server. Consequently, OIDs may conflict across different databases or servers.
func RegisterDefaultPgTypeVariants ¶
func RegisterDefaultPgTypeVariants(tMap *Map)
func RegisterTypes ¶
RegisterTypes registers all integer types (uint2, uint4, uint8, uint16 and int16) at once.
It returns a slice of pointers to the registered Type structs corresponding to these types.
The returned types can be used to register them on new connections without issuing actual database queries. For example, you can use the following code:
conn.TypeMap().RegisterTypes(types)
Note that the uniqueness of type OIDs is guaranteed only within a single server and a single database on that server. Consequently, OIDs may conflict across different databases or servers.
If there is an error while loading the types, it will be returned, along with a nil slice.
Types ¶
type Int16 ¶
func (Int16) Int64Value ¶
func (Int16) MarshalJSON ¶
func (*Int16) ScanUint64 ¶
ScanUint64 implements the Uint64Scanner interface.
func (Int16) Uint64Value ¶
func (*Int16) UnmarshalJSON ¶
type Int16Codec ¶
type Int16Codec struct{}
func (Int16Codec) DecodeDatabaseSQLValue ¶
func (Int16Codec) DecodeValue ¶
func (Int16Codec) FormatSupported ¶
func (Int16Codec) FormatSupported(format int16) bool
func (Int16Codec) PlanEncode ¶
func (Int16Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
func (Int16Codec) PlanScan ¶
func (Int16Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
func (Int16Codec) PreferredFormat ¶
func (Int16Codec) PreferredFormat() int16
type UInt16 ¶
func (UInt16) Int64Value ¶
func (UInt16) MarshalJSON ¶
func (*UInt16) ScanUint64 ¶
ScanUint64 implements the Uint64Scanner interface.
func (UInt16) Uint64Value ¶
func (*UInt16) UnmarshalJSON ¶
type UInt16Codec ¶
type UInt16Codec struct{}
func (UInt16Codec) DecodeDatabaseSQLValue ¶
func (UInt16Codec) DecodeValue ¶
func (UInt16Codec) FormatSupported ¶
func (UInt16Codec) FormatSupported(format int16) bool
func (UInt16Codec) PlanEncode ¶
func (UInt16Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
func (UInt16Codec) PlanScan ¶
func (UInt16Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
func (UInt16Codec) PreferredFormat ¶
func (UInt16Codec) PreferredFormat() int16
type UInt2 ¶
func (UInt2) Int64Value ¶
func (UInt2) MarshalJSON ¶
func (*UInt2) ScanUint64 ¶
ScanUint64 implements the Uint64Scanner interface.
func (UInt2) Uint64Value ¶
func (*UInt2) UnmarshalJSON ¶
type UInt2Codec ¶
type UInt2Codec struct{}
func (UInt2Codec) DecodeDatabaseSQLValue ¶
func (UInt2Codec) DecodeValue ¶
func (UInt2Codec) FormatSupported ¶
func (UInt2Codec) FormatSupported(format int16) bool
func (UInt2Codec) PlanEncode ¶
func (UInt2Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
func (UInt2Codec) PlanScan ¶
func (UInt2Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
func (UInt2Codec) PreferredFormat ¶
func (UInt2Codec) PreferredFormat() int16
type UInt4 ¶
func (UInt4) Int64Value ¶
func (UInt4) MarshalJSON ¶
func (*UInt4) ScanUint64 ¶
ScanUint64 implements the Uint64Scanner interface.
func (UInt4) Uint64Value ¶
func (*UInt4) UnmarshalJSON ¶
type UInt4Codec ¶
type UInt4Codec struct{}
func (UInt4Codec) DecodeDatabaseSQLValue ¶
func (UInt4Codec) DecodeValue ¶
func (UInt4Codec) FormatSupported ¶
func (UInt4Codec) FormatSupported(format int16) bool
func (UInt4Codec) PlanEncode ¶
func (UInt4Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
func (UInt4Codec) PlanScan ¶
func (UInt4Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
func (UInt4Codec) PreferredFormat ¶
func (UInt4Codec) PreferredFormat() int16
type UInt8 ¶
func (UInt8) Int64Value ¶
func (UInt8) MarshalJSON ¶
func (*UInt8) ScanUint64 ¶
ScanUint64 implements the Uint64Scanner interface.
func (UInt8) Uint64Value ¶
func (*UInt8) UnmarshalJSON ¶
type UInt8Codec ¶
type UInt8Codec struct{}
func (UInt8Codec) DecodeDatabaseSQLValue ¶
func (UInt8Codec) DecodeValue ¶
func (UInt8Codec) FormatSupported ¶
func (UInt8Codec) FormatSupported(format int16) bool
func (UInt8Codec) PlanEncode ¶
func (UInt8Codec) PlanEncode(m *Map, oid uint32, format int16, value any) EncodePlan
func (UInt8Codec) PlanScan ¶
func (UInt8Codec) PlanScan(m *Map, oid uint32, format int16, target any) ScanPlan
func (UInt8Codec) PreferredFormat ¶
func (UInt8Codec) PreferredFormat() int16