postgres_pgtype

package
v1.0.217 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

копия файла из https://github.com/jackc/pgtype/timestamptz.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/interval.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/pgtype.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/pgtype_default.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/timestamptz.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/timestamp.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

копия файла из https://github.com/jackc/pgtype/timestamptz.go чтоб не выдавала ошибку на null чтобы дата NULL = time.Time{}

Index

Constants

View Source
const (
	BoolOID                = 16
	ByteaOID               = 17
	QCharOID               = 18
	NameOID                = 19
	Int8OID                = 20
	Int2OID                = 21
	Int4OID                = 23
	TextOID                = 25
	OIDOID                 = 26
	TIDOID                 = 27
	XIDOID                 = 28
	CIDOID                 = 29
	JSONOID                = 114
	XMLOID                 = 142
	XMLArrayOID            = 143
	JSONArrayOID           = 199
	XID8ArrayOID           = 271
	PointOID               = 600
	LsegOID                = 601
	PathOID                = 602
	BoxOID                 = 603
	PolygonOID             = 604
	LineOID                = 628
	LineArrayOID           = 629
	CIDROID                = 650
	CIDRArrayOID           = 651
	Float4OID              = 700
	Float8OID              = 701
	CircleOID              = 718
	CircleArrayOID         = 719
	UnknownOID             = 705
	Macaddr8OID            = 774
	MacaddrOID             = 829
	InetOID                = 869
	BoolArrayOID           = 1000
	QCharArrayOID          = 1002
	NameArrayOID           = 1003
	Int2ArrayOID           = 1005
	Int4ArrayOID           = 1007
	TextArrayOID           = 1009
	TIDArrayOID            = 1010
	ByteaArrayOID          = 1001
	XIDArrayOID            = 1011
	CIDArrayOID            = 1012
	BPCharArrayOID         = 1014
	VarcharArrayOID        = 1015
	Int8ArrayOID           = 1016
	PointArrayOID          = 1017
	LsegArrayOID           = 1018
	PathArrayOID           = 1019
	BoxArrayOID            = 1020
	Float4ArrayOID         = 1021
	Float8ArrayOID         = 1022
	PolygonArrayOID        = 1027
	OIDArrayOID            = 1028
	ACLItemOID             = 1033
	ACLItemArrayOID        = 1034
	MacaddrArrayOID        = 1040
	InetArrayOID           = 1041
	BPCharOID              = 1042
	VarcharOID             = 1043
	DateOID                = 1082
	TimeOID                = 1083
	TimestampOID           = 1114
	TimestampArrayOID      = 1115
	DateArrayOID           = 1182
	TimeArrayOID           = 1183
	TimestamptzOID         = 1184
	TimestamptzArrayOID    = 1185
	IntervalOID            = 1186
	IntervalArrayOID       = 1187
	NumericArrayOID        = 1231
	TimetzOID              = 1266
	TimetzArrayOID         = 1270
	BitOID                 = 1560
	BitArrayOID            = 1561
	VarbitOID              = 1562
	VarbitArrayOID         = 1563
	NumericOID             = 1700
	RecordOID              = 2249
	RecordArrayOID         = 2287
	UUIDOID                = 2950
	UUIDArrayOID           = 2951
	JSONBOID               = 3802
	JSONBArrayOID          = 3807
	DaterangeOID           = 3912
	DaterangeArrayOID      = 3913
	Int4rangeOID           = 3904
	Int4rangeArrayOID      = 3905
	NumrangeOID            = 3906
	NumrangeArrayOID       = 3907
	TsrangeOID             = 3908
	TsrangeArrayOID        = 3909
	TstzrangeOID           = 3910
	TstzrangeArrayOID      = 3911
	Int8rangeOID           = 3926
	Int8rangeArrayOID      = 3927
	JSONPathOID            = 4072
	JSONPathArrayOID       = 4073
	Int4multirangeOID      = 4451
	NummultirangeOID       = 4532
	TsmultirangeOID        = 4533
	TstzmultirangeOID      = 4534
	DatemultirangeOID      = 4535
	Int8multirangeOID      = 4536
	XID8OID                = 5069
	Int4multirangeArrayOID = 6150
	NummultirangeArrayOID  = 6151
	TsmultirangeArrayOID   = 6152
	TstzmultirangeArrayOID = 6153
	DatemultirangeArrayOID = 6155
	Int8multirangeArrayOID = 6157
)

PostgreSQL oids for common types

Variables

This section is empty.

Functions

func AppendInt16

func AppendInt16(buf []byte, n int16) []byte

func AppendInt32

func AppendInt32(buf []byte, n int32) []byte

func AppendInt64

func AppendInt64(buf []byte, n int64) []byte

func AppendUint16

func AppendUint16(buf []byte, n uint16) []byte

func AppendUint32

func AppendUint32(buf []byte, n uint32) []byte

func AppendUint64

func AppendUint64(buf []byte, n uint64) []byte

func SetInt32

func SetInt32(buf []byte, n int32)

Types

type Date

type Date struct {
	Time             time.Time
	InfinityModifier pgtype.InfinityModifier
	Valid            bool
}

func (Date) DateValue

func (d Date) DateValue() (Date, error)

func (Date) MarshalJSON

func (src Date) MarshalJSON() ([]byte, error)

func (*Date) Scan

func (dst *Date) Scan(src any) error

Scan implements the database/sql Scanner interface.

func (*Date) ScanDate

func (d *Date) ScanDate(v Date) error

func (*Date) UnmarshalJSON

func (dst *Date) UnmarshalJSON(b []byte) error

func (Date) Value

func (src Date) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type DateCodec

type DateCodec struct{}

func (DateCodec) DecodeDatabaseSQLValue

func (c DateCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)

func (DateCodec) DecodeValue

func (c DateCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)

func (DateCodec) FormatSupported

func (DateCodec) FormatSupported(format int16) bool

func (DateCodec) PlanEncode

func (DateCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan

func (DateCodec) PlanScan

func (DateCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan

func (DateCodec) PreferredFormat

func (DateCodec) PreferredFormat() int16

type Interval

type Interval struct {
	Microseconds int64
	Days         int32
	Months       int32
	Valid        bool
}

func (Interval) IntervalValue

func (interval Interval) IntervalValue() (Interval, error)

func (*Interval) Scan

func (interval *Interval) Scan(src any) error

Scan implements the database/sql Scanner interface.

func (*Interval) ScanInterval

func (interval *Interval) ScanInterval(v Interval) error

func (Interval) Value

func (interval Interval) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type IntervalCodec

type IntervalCodec struct{}

func (IntervalCodec) DecodeDatabaseSQLValue

func (c IntervalCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)

func (IntervalCodec) DecodeValue

func (c IntervalCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)

func (IntervalCodec) FormatSupported

func (IntervalCodec) FormatSupported(format int16) bool

func (IntervalCodec) PlanEncode

func (IntervalCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan

func (IntervalCodec) PlanScan

func (IntervalCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan

func (IntervalCodec) PreferredFormat

func (IntervalCodec) PreferredFormat() int16

type IntervalScanner

type IntervalScanner interface {
	ScanInterval(v Interval) error
}

type IntervalValuer

type IntervalValuer interface {
	IntervalValue() (Interval, error)
}

type Time

type Time struct {
	Microseconds int64 // Number of microseconds since midnight
	Valid        bool
}

Time represents the PostgreSQL time type. The PostgreSQL time is a time of day without time zone.

Time is represented as the number of microseconds since midnight in the same way that PostgreSQL does. Other time and date types in pgtype can use time.Time as the underlying representation. However, pgtype.Time type cannot due to needing to handle 24:00:00. time.Time converts that to 00:00:00 on the following day.

The time with time zone type is not supported. Use of time with time zone is discouraged by the PostgreSQL documentation.

func (*Time) Scan

func (t *Time) Scan(src any) error

Scan implements the database/sql Scanner interface.

func (*Time) ScanTime

func (t *Time) ScanTime(v Time) error

func (Time) TimeValue

func (t Time) TimeValue() (Time, error)

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type TimeCodec

type TimeCodec struct{}

func (TimeCodec) DecodeDatabaseSQLValue

func (c TimeCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)

func (TimeCodec) DecodeValue

func (c TimeCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)

func (TimeCodec) FormatSupported

func (TimeCodec) FormatSupported(format int16) bool

func (TimeCodec) PlanEncode

func (TimeCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan

func (TimeCodec) PlanScan

func (TimeCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan

func (TimeCodec) PreferredFormat

func (TimeCodec) PreferredFormat() int16

type TimeScanner added in v1.0.205

type TimeScanner interface {
	ScanTime(v Time) error
}

type Timestamp

type Timestamp struct {
	Time             time.Time // Time zone will be ignored when encoding to PostgreSQL.
	InfinityModifier pgtype.InfinityModifier
	Valid            bool
}

Timestamp represents the PostgreSQL timestamp type.

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) Scan

func (ts *Timestamp) Scan(src any) error

Scan implements the database/sql Scanner interface.

func (*Timestamp) ScanTimestamp

func (ts *Timestamp) ScanTimestamp(v Timestamp) error

func (Timestamp) TimestampValue

func (ts Timestamp) TimestampValue() (Timestamp, error)

func (*Timestamp) UnmarshalJSON

func (ts *Timestamp) UnmarshalJSON(b []byte) error

func (Timestamp) Value

func (ts Timestamp) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type TimestampCodec

type TimestampCodec struct {
	// ScanLocation is the location that the time is assumed to be in for scanning. This is different from
	// TimestamptzCodec.ScanLocation in that this setting does change the instant in time that the timestamp represents.
	ScanLocation *time.Location
}

func (*TimestampCodec) DecodeDatabaseSQLValue

func (c *TimestampCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)

func (*TimestampCodec) DecodeValue

func (c *TimestampCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)

func (*TimestampCodec) FormatSupported

func (*TimestampCodec) FormatSupported(format int16) bool

func (*TimestampCodec) PlanEncode

func (*TimestampCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan

func (*TimestampCodec) PlanScan

func (c *TimestampCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan

func (*TimestampCodec) PreferredFormat

func (*TimestampCodec) PreferredFormat() int16

type Timestamptz

type Timestamptz struct {
	Time             time.Time
	InfinityModifier pgtype.InfinityModifier
	Valid            bool
}

Timestamptz represents the PostgreSQL timestamptz type.

func (Timestamptz) MarshalJSON

func (tstz Timestamptz) MarshalJSON() ([]byte, error)

func (*Timestamptz) Scan

func (tstz *Timestamptz) Scan(src any) error

Scan implements the database/sql Scanner interface.

func (*Timestamptz) ScanTimestamptz

func (tstz *Timestamptz) ScanTimestamptz(v Timestamptz) error

func (Timestamptz) TimestamptzValue

func (tstz Timestamptz) TimestamptzValue() (Timestamptz, error)

func (*Timestamptz) UnmarshalJSON

func (tstz *Timestamptz) UnmarshalJSON(b []byte) error

func (Timestamptz) Value

func (tstz Timestamptz) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type TimestamptzCodec

type TimestamptzCodec struct {
	// ScanLocation is the location to return scanned timestamptz values in. This does not change the instant in time that
	// the timestamptz represents.
	ScanLocation *time.Location
}

func (*TimestamptzCodec) DecodeDatabaseSQLValue

func (c *TimestamptzCodec) DecodeDatabaseSQLValue(m *pgtype.Map, oid uint32, format int16, src []byte) (driver.Value, error)

func (*TimestamptzCodec) DecodeValue

func (c *TimestamptzCodec) DecodeValue(m *pgtype.Map, oid uint32, format int16, src []byte) (any, error)

func (*TimestamptzCodec) FormatSupported

func (*TimestamptzCodec) FormatSupported(format int16) bool

func (*TimestamptzCodec) PlanEncode

func (*TimestamptzCodec) PlanEncode(m *pgtype.Map, oid uint32, format int16, value any) pgtype.EncodePlan

func (*TimestamptzCodec) PlanScan

func (c *TimestamptzCodec) PlanScan(m *pgtype.Map, oid uint32, format int16, target any) pgtype.ScanPlan

func (*TimestamptzCodec) PreferredFormat

func (*TimestamptzCodec) PreferredFormat() int16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL