tstype

package
v0.0.0-...-19bee3a Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Inclusive = BoundType('i')
	Exclusive = BoundType('e')
	Unbounded = BoundType('U')
	Empty     = BoundType('E')
)

Variables

This section is empty.

Functions

func DatabaseSQLValue

func DatabaseSQLValue(ci *pgtype.ConnInfo, src pgtype.Value) (interface{}, error)

func EncodeValueText

func EncodeValueText(src pgtype.TextEncoder) (interface{}, error)

func GetAssignToDstType

func GetAssignToDstType(dst interface{}) (interface{}, bool)

GetAssignToDstType attempts to convert dst to something AssignTo can assign to. If dst is a pointer to pointer it allocates a value and returns the dereferences pointer. If dst is a named type such as *Foo where Foo is type Foo int16, it converts dst to *int16.

GetAssignToDstType returns the converted dst and a bool representing if any change was made.

func NullAssignTo

func NullAssignTo(dst interface{}) error

Types

type Bool

type Bool struct {
	Bool   bool
	Status Status
}

func (*Bool) AssignTo

func (src *Bool) AssignTo(dst interface{}) error

func (*Bool) DecodeBinary

func (dst *Bool) DecodeBinary(_ *pgtype.ConnInfo, src []byte) error

func (*Bool) DecodeText

func (dst *Bool) DecodeText(_ *pgtype.ConnInfo, src []byte) error

func (Bool) EncodeBinary

func (src Bool) EncodeBinary(_ *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Bool) EncodeText

func (src Bool) EncodeText(_ *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Bool) Get

func (dst Bool) Get() interface{}

func (Bool) MarshalJSON

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

func (*Bool) Scan

func (dst *Bool) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Bool) Set

func (dst *Bool) Set(src interface{}) error

func (*Bool) UnmarshalJSON

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

func (Bool) Value

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

Value implements the database/sql/driver Valuer interface.

func (Bool) ValueOrZero

func (dst Bool) ValueOrZero() bool

type BoundType

type BoundType byte

func (BoundType) String

func (bt BoundType) String() string

type Hstore

type Hstore struct {
	Map    map[string]Text
	Status Status
}

Hstore represents an hstore column that can be null or have null values associated with its keys.

func (*Hstore) AssignTo

func (src *Hstore) AssignTo(dst interface{}) error

func (*Hstore) DecodeBinary

func (dst *Hstore) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Hstore) DecodeText

func (dst *Hstore) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Hstore) EncodeBinary

func (src Hstore) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Hstore) EncodeText

func (src Hstore) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Hstore) Get

func (dst Hstore) Get() interface{}

func (Hstore) Len

func (dst Hstore) Len() int

func (Hstore) MarshalJSON

func (src Hstore) MarshalJSON() (b []byte, err error)

func (*Hstore) Scan

func (dst *Hstore) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Hstore) Set

func (dst *Hstore) Set(src interface{}) error

func (*Hstore) UnmarshalJSON

func (dst *Hstore) UnmarshalJSON(b []byte) (err error)

func (Hstore) Value

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

Value implements the database/sql/driver Valuer interface.

type Inet

type Inet struct {
	IPNet  *net.IPNet
	Status Status
}

Inet represents both inet and cidr PostgreSQL types.

func (*Inet) AssignTo

func (src *Inet) AssignTo(dst interface{}) error

func (*Inet) DecodeBinary

func (dst *Inet) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Inet) DecodeText

func (dst *Inet) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Inet) EncodeBinary

func (src Inet) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

EncodeBinary encodes src into w.

func (Inet) EncodeText

func (src Inet) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Inet) Get

func (dst Inet) Get() interface{}

func (Inet) MarshalJSON

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

func (*Inet) Scan

func (dst *Inet) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Inet) Set

func (dst *Inet) Set(src interface{}) error

func (*Inet) UnmarshalJSON

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

func (Inet) Value

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

Value implements the database/sql/driver Valuer interface.

type InetArray

type InetArray struct {
	Elements   []Inet
	Dimensions []pgtype.ArrayDimension
	Status     Status
}

func (*InetArray) AssignTo

func (src *InetArray) AssignTo(dst interface{}) error

func (*InetArray) DecodeBinary

func (dst *InetArray) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*InetArray) DecodeText

func (dst *InetArray) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (InetArray) EncodeBinary

func (src InetArray) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (InetArray) EncodeText

func (src InetArray) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (InetArray) Get

func (dst InetArray) Get() interface{}

func (InetArray) Len

func (dst InetArray) Len() int

func (InetArray) MarshalJSON

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

func (*InetArray) Scan

func (dst *InetArray) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*InetArray) Set

func (dst *InetArray) Set(src interface{}) error

func (*InetArray) UnmarshalJSON

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

func (InetArray) Value

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

Value implements the database/sql/driver Valuer interface.

type JSON

type JSON struct {
	Bytes  []byte
	Status Status
}

func (*JSON) AssignTo

func (src *JSON) AssignTo(dst interface{}) error

func (*JSON) DecodeBinary

func (dst *JSON) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*JSON) DecodeText

func (dst *JSON) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (JSON) EncodeBinary

func (src JSON) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (JSON) EncodeText

func (src JSON) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (JSON) Get

func (dst JSON) Get() interface{}

func (JSON) MarshalJSON

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

func (JSON) PreferredParamFormat

func (JSON) PreferredParamFormat() int16

func (JSON) PreferredResultFormat

func (JSON) PreferredResultFormat() int16

func (*JSON) Scan

func (dst *JSON) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*JSON) Set

func (dst *JSON) Set(src interface{}) error

func (*JSON) UnmarshalJSON

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

func (JSON) Value

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

Value implements the database/sql/driver Valuer interface.

type JSONB

type JSONB JSON

func (*JSONB) AssignTo

func (src *JSONB) AssignTo(dst interface{}) error

func (*JSONB) DecodeBinary

func (dst *JSONB) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*JSONB) DecodeText

func (dst *JSONB) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (JSONB) EncodeBinary

func (src JSONB) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (JSONB) EncodeText

func (src JSONB) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (JSONB) Get

func (dst JSONB) Get() interface{}

func (JSONB) MarshalJSON

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

func (JSONB) PreferredParamFormat

func (JSONB) PreferredParamFormat() int16

func (JSONB) PreferredResultFormat

func (JSONB) PreferredResultFormat() int16

func (*JSONB) Scan

func (dst *JSONB) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*JSONB) Set

func (dst *JSONB) Set(src interface{}) error

func (*JSONB) UnmarshalJSON

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

func (JSONB) Value

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

Value implements the database/sql/driver Valuer interface.

type Numeric

type Numeric struct {
	Decimal decimal.Decimal
	Status  Status
}

func (*Numeric) AssignTo

func (src *Numeric) AssignTo(dst interface{}) error

func (*Numeric) DecodeBinary

func (dst *Numeric) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Numeric) DecodeText

func (dst *Numeric) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Numeric) EncodeBinary

func (src Numeric) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Numeric) EncodeText

func (src Numeric) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Numeric) Get

func (dst Numeric) Get() interface{}

func (Numeric) MarshalJSON

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

func (*Numeric) Scan

func (dst *Numeric) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Numeric) Set

func (dst *Numeric) Set(src interface{}) error

func (*Numeric) UnmarshalJSON

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

func (Numeric) Value

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

Value implements the database/sql/driver Valuer interface.

type Status

type Status byte
const (
	Null Status = iota
	Present
)

type Text

type Text struct {
	String string
	Status Status
}

func (*Text) AssignTo

func (src *Text) AssignTo(dst interface{}) error

func (*Text) DecodeBinary

func (dst *Text) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Text) DecodeText

func (dst *Text) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Text) EncodeBinary

func (src Text) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Text) EncodeText

func (src Text) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Text) Get

func (dst Text) Get() interface{}

func (Text) IsZero

func (dst Text) IsZero() bool

func (Text) MarshalJSON

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

func (Text) PreferredParamFormat

func (Text) PreferredParamFormat() int16

func (Text) PreferredResultFormat

func (Text) PreferredResultFormat() int16

func (*Text) Scan

func (dst *Text) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Text) Set

func (dst *Text) Set(src interface{}) error

func (*Text) UnmarshalJSON

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

func (Text) Value

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

Value implements the database/sql/driver Valuer interface.

func (Text) ValueOrZero

func (dst Text) ValueOrZero() string

type Timestamptz

type Timestamptz struct {
	Time             time.Time
	Status           Status
	InfinityModifier pgtype.InfinityModifier
}

func (*Timestamptz) AssignTo

func (src *Timestamptz) AssignTo(dst interface{}) error

func (*Timestamptz) DecodeBinary

func (dst *Timestamptz) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Timestamptz) DecodeText

func (dst *Timestamptz) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Timestamptz) EncodeBinary

func (src Timestamptz) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Timestamptz) EncodeText

func (src Timestamptz) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Timestamptz) Get

func (dst Timestamptz) Get() interface{}

func (Timestamptz) IsZero

func (dst Timestamptz) IsZero() bool

func (Timestamptz) MarshalJSON

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

func (*Timestamptz) Scan

func (dst *Timestamptz) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Timestamptz) Set

func (dst *Timestamptz) Set(src interface{}) error

func (*Timestamptz) UnmarshalJSON

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

func (Timestamptz) Value

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

Value implements the database/sql/driver Valuer interface.

func (Timestamptz) ValueOrZero

func (dst Timestamptz) ValueOrZero() time.Time

type Tstzrange

type Tstzrange struct {
	Lower     Timestamptz
	Upper     Timestamptz
	LowerType pgtype.BoundType
	UpperType pgtype.BoundType
	Status    Status
}

func (*Tstzrange) AssignTo

func (src *Tstzrange) AssignTo(dst interface{}) error

func (*Tstzrange) DecodeBinary

func (dst *Tstzrange) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Tstzrange) DecodeText

func (dst *Tstzrange) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Tstzrange) EncodeBinary

func (src Tstzrange) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Tstzrange) EncodeText

func (src Tstzrange) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Tstzrange) Get

func (dst Tstzrange) Get() interface{}

func (*Tstzrange) Scan

func (dst *Tstzrange) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Tstzrange) Set

func (dst *Tstzrange) Set(src interface{}) error

func (Tstzrange) Value

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

Value implements the database/sql/driver Valuer interface.

type UUID

type UUID struct {
	UUID   uuid.UUID
	Status Status
}

func (*UUID) AssignTo

func (src *UUID) AssignTo(dst interface{}) error

func (*UUID) DecodeBinary

func (dst *UUID) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*UUID) DecodeText

func (dst *UUID) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (UUID) EncodeBinary

func (src UUID) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (UUID) EncodeText

func (src UUID) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (UUID) Get

func (dst UUID) Get() interface{}

func (UUID) IsZero

func (dst UUID) IsZero() bool

func (UUID) MarshalJSON

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

func (*UUID) Scan

func (dst *UUID) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*UUID) Set

func (dst *UUID) Set(src interface{}) error

func (UUID) String

func (dst UUID) String() string

func (*UUID) UnmarshalJSON

func (dst *UUID) UnmarshalJSON(b []byte) (err error)

func (UUID) Value

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

Value implements the database/sql/driver Valuer interface.

func (UUID) ValueOrZero

func (dst UUID) ValueOrZero() uuid.UUID

type UUIDArray

type UUIDArray struct {
	Elements   []UUID
	Dimensions []pgtype.ArrayDimension
	Status     Status
}

func (*UUIDArray) AssignTo

func (src *UUIDArray) AssignTo(dst interface{}) error

func (*UUIDArray) DecodeBinary

func (dst *UUIDArray) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*UUIDArray) DecodeText

func (dst *UUIDArray) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (UUIDArray) EncodeBinary

func (src UUIDArray) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (UUIDArray) EncodeText

func (src UUIDArray) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (UUIDArray) Get

func (dst UUIDArray) Get() interface{}

func (UUIDArray) Len

func (dst UUIDArray) Len() int

func (UUIDArray) MarshalJSON

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

func (*UUIDArray) Scan

func (dst *UUIDArray) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*UUIDArray) Set

func (dst *UUIDArray) Set(src interface{}) error

func (*UUIDArray) UnmarshalJSON

func (dst *UUIDArray) UnmarshalJSON(b []byte) (err error)

func (UUIDArray) Value

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

Value implements the database/sql/driver Valuer interface.

type UntypedBinaryRange

type UntypedBinaryRange struct {
	Lower     []byte
	Upper     []byte
	LowerType BoundType
	UpperType BoundType
}

func ParseUntypedBinaryRange

func ParseUntypedBinaryRange(src []byte) (*UntypedBinaryRange, error)

type UntypedTextRange

type UntypedTextRange struct {
	Lower     string
	Upper     string
	LowerType BoundType
	UpperType BoundType
}

func ParseUntypedTextRange

func ParseUntypedTextRange(src string) (*UntypedTextRange, error)

type Varchar

type Varchar Text

func (*Varchar) AssignTo

func (src *Varchar) AssignTo(dst interface{}) error

AssignTo assigns from src to dst. Note that as Varchar is not a general number type AssignTo does not do automatic type conversion as other number types do.

func (*Varchar) DecodeBinary

func (dst *Varchar) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*Varchar) DecodeText

func (dst *Varchar) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (Varchar) EncodeBinary

func (src Varchar) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Varchar) EncodeText

func (src Varchar) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (Varchar) Get

func (dst Varchar) Get() interface{}

func (Varchar) IsZero

func (dst Varchar) IsZero() bool

func (Varchar) MarshalJSON

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

func (Varchar) PreferredParamFormat

func (Varchar) PreferredParamFormat() int16

func (Varchar) PreferredResultFormat

func (Varchar) PreferredResultFormat() int16

func (*Varchar) Scan

func (dst *Varchar) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*Varchar) Set

func (dst *Varchar) Set(src interface{}) error

Set converts from src to dst. Note that as Varchar is not a general number type Set does not do automatic type conversion as other number types do.

func (*Varchar) UnmarshalJSON

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

func (Varchar) Value

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

Value implements the database/sql/driver Valuer interface.

func (Varchar) ValueOrZero

func (dst Varchar) ValueOrZero() string

type VarcharArray

type VarcharArray struct {
	Elements   []Varchar
	Dimensions []pgtype.ArrayDimension
	Status     Status
}

func (*VarcharArray) AssignTo

func (src *VarcharArray) AssignTo(dst interface{}) error

func (*VarcharArray) DecodeBinary

func (dst *VarcharArray) DecodeBinary(ci *pgtype.ConnInfo, src []byte) error

func (*VarcharArray) DecodeText

func (dst *VarcharArray) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (VarcharArray) EncodeBinary

func (src VarcharArray) EncodeBinary(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (VarcharArray) EncodeText

func (src VarcharArray) EncodeText(ci *pgtype.ConnInfo, buf []byte) ([]byte, error)

func (VarcharArray) Get

func (dst VarcharArray) Get() interface{}

func (VarcharArray) MarshalJSON

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

func (*VarcharArray) Scan

func (dst *VarcharArray) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (*VarcharArray) Set

func (dst *VarcharArray) Set(src interface{}) error

func (*VarcharArray) UnmarshalJSON

func (dst *VarcharArray) UnmarshalJSON(b []byte) (err error)

func (VarcharArray) Value

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

Value implements the database/sql/driver Valuer interface.

Jump to

Keyboard shortcuts

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