pgtypes

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Package pgtypes provides GORM-compatible custom PostgreSQL types.

Index

Constants

This section is empty.

Variables

View Source
var PgTypeMap = map[string]string{

	"text[]":                        "pgtypes.StringArray",
	"varchar[]":                     "pgtypes.StringArray",
	"integer[]":                     "pgtypes.Int32Array",
	"int4[]":                        "pgtypes.Int32Array",
	"int8[]":                        "pgtypes.Int64Array",
	"bigint[]":                      "pgtypes.Int64Array",
	"bool[]":                        "pgtypes.BoolArray",
	"boolean[]":                     "pgtypes.BoolArray",
	"uuid[]":                        "pgtypes.UUIDArray",
	"float8[]":                      "pgtypes.Float64Array",
	"double precision[]":            "pgtypes.Float64Array",
	"timestamptz[]":                 "pgtypes.TimeArray",
	"timestamp[]":                   "pgtypes.TimeArray",
	"timestamp with time zone[]":    "pgtypes.TimeArray",
	"timestamp without time zone[]": "pgtypes.TimeArray",

	"interval":   "pgtypes.Duration",
	"interval[]": "pgtypes.DurationArray",

	"bool": "bool",

	"int2": "int16",
	"int4": "int32",
	"int8": "int64",

	"float4": "float32",
	"float8": "float64",

	"numeric": "string",

	"text":    "string",
	"varchar": "string",
	"bpchar":  "string",
	"char":    "string",
	"name":    "string",

	"bytea": "[]byte",

	"uuid": "uuid.UUID",

	"json":  "json.RawMessage",
	"jsonb": "json.RawMessage",

	"xml": "string",

	"date":        "time.Time",
	"timestamp":   "time.Time",
	"timestamptz": "time.Time",

	"time":   "string",
	"timetz": "string",

	"inet":     "net.IPNet",
	"cidr":     "net.IPNet",
	"macaddr":  "net.HardwareAddr",
	"macaddr8": "net.HardwareAddr",

	"bit":    "string",
	"varbit": "string",

	"tsvector": "string",
	"tsquery":  "string",

	"vector":      "string",
	"vector(384)": "string",
	"halfvec":     "string",
	"sparsevec":   "string",

	"oid":           "uint32",
	"regclass":      "uint32",
	"regproc":       "uint32",
	"regprocedure":  "uint32",
	"regtype":       "uint32",
	"regrole":       "uint32",
	"regnamespace":  "uint32",
	"regconfig":     "uint32",
	"regdictionary": "uint32",

	"pg_lsn":        "string",
	"txid_snapshot": "string",

	"point":   "string",
	"line":    "string",
	"lseg":    "string",
	"box":     "string",
	"path":    "string",
	"polygon": "string",
	"circle":  "string",

	"int4range": "string",
	"int8range": "string",
	"numrange":  "string",
	"tsrange":   "string",
	"tstzrange": "string",
	"daterange": "string",

	"int4multirange": "string",
	"int8multirange": "string",
	"nummultirange":  "string",
	"tsmultirange":   "string",
	"tstzmultirange": "string",
	"datemultirange": "string",

	"money": "string",
}

PgTypeMap maps PostgreSQL data types to their corresponding Go types as strings. This map is used during code generation to determine the field types of the generated structs.

Functions

This section is empty.

Types

type BoolArray

type BoolArray []bool

BoolArray is a slice of booleans that supports PostgreSQL's boolean array type.

func (BoolArray) Append

func (a BoolArray) Append(vals ...bool) BoolArray

Append returns a new BoolArray with the given values appended.

func (BoolArray) AsSlice

func (a BoolArray) AsSlice() []bool

AsSlice converts the BoolArray to a bool slice.

func (BoolArray) Contains

func (a BoolArray) Contains(val bool) bool

Contains returns true if the BoolArray contains the given value.

func (BoolArray) Equals

func (a BoolArray) Equals(b BoolArray) bool

Equals returns true if the BoolArray is equal to another BoolArray.

func (BoolArray) Filter

func (a BoolArray) Filter(f func(bool) bool) BoolArray

Filter returns a new BoolArray containing only elements that satisfy the given predicate.

func (BoolArray) FromSlice

func (BoolArray) FromSlice(s []bool) BoolArray

FromSlice converts a bool slice to a BoolArray.

func (BoolArray) GormDBDataType

func (BoolArray) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (BoolArray) GormDataType

func (BoolArray) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (BoolArray) IndexOf

func (a BoolArray) IndexOf(val bool) int

IndexOf returns the index of the first occurrence of the given value, or -1 if not found.

func (BoolArray) IsEmpty

func (a BoolArray) IsEmpty() bool

IsEmpty returns true if the BoolArray is empty.

func (BoolArray) Len

func (a BoolArray) Len() int

Len implements sort.Interface.

func (BoolArray) Less

func (a BoolArray) Less(i, j int) bool

Less implements sort.Interface.

func (BoolArray) MarshalJSON

func (a BoolArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (BoolArray) MarshalText

func (a BoolArray) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*BoolArray) Scan

func (a *BoolArray) Scan(src any) error

Scan implements the sql.Scanner interface.

func (BoolArray) String

func (a BoolArray) String() string

String returns the string representation of the BoolArray.

func (BoolArray) Swap

func (a BoolArray) Swap(i, j int)

Swap implements sort.Interface.

func (BoolArray) Unique

func (a BoolArray) Unique() BoolArray

Unique returns a new BoolArray with duplicate values removed.

func (*BoolArray) UnmarshalJSON

func (a *BoolArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*BoolArray) UnmarshalText

func (a *BoolArray) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (BoolArray) Value

func (a BoolArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Duration

type Duration struct {
	time.Duration
}

Duration is a wrapper around time.Duration that supports PostgreSQL's interval type.

func FromDuration

func FromDuration(d time.Duration) Duration

FromDuration converts a time.Duration to a Duration.

func (Duration) AsDuration

func (d Duration) AsDuration() time.Duration

AsDuration converts the Duration to a time.Duration.

func (Duration) Equals

func (d Duration) Equals(other Duration) bool

Equals returns true if the Duration is equal to another Duration.

func (Duration) GormDBDataType

func (Duration) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (Duration) GormDataType

func (Duration) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Duration) MarshalText

func (d Duration) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Duration) Scan

func (d *Duration) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Duration) String

func (d Duration) String() string

String returns the string representation of the Duration.

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Duration) Value

func (d Duration) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type DurationArray

type DurationArray []Duration

DurationArray is a slice of Durations that supports PostgreSQL's interval array type.

func (DurationArray) Append

func (a DurationArray) Append(vals ...time.Duration) DurationArray

Append returns a new DurationArray with the given values appended.

func (DurationArray) AsSlice

func (a DurationArray) AsSlice() []time.Duration

AsSlice converts the DurationArray to a time.Duration slice.

func (DurationArray) Contains

func (a DurationArray) Contains(val time.Duration) bool

Contains returns true if the DurationArray contains the given value.

func (DurationArray) Equals

func (a DurationArray) Equals(b DurationArray) bool

Equals returns true if the DurationArray is equal to another DurationArray.

func (DurationArray) Filter

func (a DurationArray) Filter(f func(time.Duration) bool) DurationArray

Filter returns a new DurationArray containing only elements that satisfy the given predicate.

func (DurationArray) FromSlice

func (DurationArray) FromSlice(s []time.Duration) DurationArray

FromSlice converts a time.Duration slice to a DurationArray.

func (DurationArray) GormDBDataType

func (DurationArray) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (DurationArray) GormDataType

func (DurationArray) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (DurationArray) IndexOf

func (a DurationArray) IndexOf(val time.Duration) int

IndexOf returns the index of the first occurrence of the given value, or -1 if not found.

func (DurationArray) IsEmpty

func (a DurationArray) IsEmpty() bool

IsEmpty returns true if the DurationArray is empty.

func (DurationArray) Len

func (a DurationArray) Len() int

Len implements sort.Interface.

func (DurationArray) Less

func (a DurationArray) Less(i, j int) bool

Less implements sort.Interface.

func (DurationArray) MarshalJSON

func (a DurationArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (DurationArray) MarshalText

func (a DurationArray) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*DurationArray) Scan

func (a *DurationArray) Scan(src any) error

Scan implements the sql.Scanner interface.

func (DurationArray) String

func (a DurationArray) String() string

String returns the string representation of the DurationArray.

func (DurationArray) Swap

func (a DurationArray) Swap(i, j int)

Swap implements sort.Interface.

func (DurationArray) Unique

func (a DurationArray) Unique() DurationArray

Unique returns a new DurationArray with duplicate values removed.

func (*DurationArray) UnmarshalJSON

func (a *DurationArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*DurationArray) UnmarshalText

func (a *DurationArray) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (DurationArray) Value

func (a DurationArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Float64Array

type Float64Array []float64

Float64Array represents a PostgreSQL double precision array ([]double precision).

func (Float64Array) Append

func (a Float64Array) Append(vals ...float64) Float64Array

Append returns a new Float64Array with the specified values added.

func (Float64Array) AsSlice

func (a Float64Array) AsSlice() []float64

AsSlice converts the Float64Array to a float64 slice.

func (Float64Array) Contains

func (a Float64Array) Contains(val float64) bool

Contains returns true if the value exists in the array.

func (Float64Array) Equals

func (a Float64Array) Equals(b Float64Array) bool

Equals returns true if the other Float64Array has the same values in order.

func (Float64Array) Filter

func (a Float64Array) Filter(f func(float64) bool) Float64Array

Filter returns a new Float64Array with elements matching the filter.

func (Float64Array) FromSlice

func (Float64Array) FromSlice(s []float64) Float64Array

FromSlice converts a float64 slice to a Float64Array.

func (Float64Array) GormDBDataType

func (Float64Array) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (Float64Array) GormDataType

func (Float64Array) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (Float64Array) IndexOf

func (a Float64Array) IndexOf(val float64) int

IndexOf returns the index of the value, or -1 if not found.

func (Float64Array) IsEmpty

func (a Float64Array) IsEmpty() bool

IsEmpty returns true if the array has no elements.

func (Float64Array) Len

func (a Float64Array) Len() int

Len implements sort.Interface.

func (Float64Array) Less

func (a Float64Array) Less(i, j int) bool

Less implements sort.Interface.

func (Float64Array) MarshalJSON

func (a Float64Array) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Float64Array) MarshalText

func (a Float64Array) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Float64Array) Scan

func (a *Float64Array) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Float64Array) String

func (a Float64Array) String() string

String returns the string representation of the Float64Array.

func (Float64Array) Swap

func (a Float64Array) Swap(i, j int)

Swap implements sort.Interface.

func (Float64Array) Unique

func (a Float64Array) Unique() Float64Array

Unique returns a new Float64Array with duplicate values removed.

func (*Float64Array) UnmarshalJSON

func (a *Float64Array) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Float64Array) UnmarshalText

func (a *Float64Array) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Float64Array) Value

func (a Float64Array) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Int32Array

type Int32Array []int32

Int32Array represents a PostgreSQL integer array ([]integer).

func (Int32Array) Append

func (a Int32Array) Append(vals ...int32) Int32Array

Append returns a new Int32Array with the specified values added.

func (Int32Array) AsSlice

func (a Int32Array) AsSlice() []int32

AsSlice converts the Int32Array to an int32 slice.

func (Int32Array) Contains

func (a Int32Array) Contains(val int32) bool

Contains returns true if the value exists in the array.

func (Int32Array) Equals

func (a Int32Array) Equals(b Int32Array) bool

Equals returns true if the other Int32Array has the same values in order.

func (Int32Array) Filter

func (a Int32Array) Filter(f func(int32) bool) Int32Array

Filter returns a new Int32Array with elements matching the filter.

func (Int32Array) FromSlice

func (Int32Array) FromSlice(s []int32) Int32Array

FromSlice converts an int32 slice to an Int32Array.

func (Int32Array) GormDBDataType

func (Int32Array) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (Int32Array) GormDataType

func (Int32Array) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (Int32Array) IndexOf

func (a Int32Array) IndexOf(val int32) int

IndexOf returns the index of the value, or -1 if not found.

func (Int32Array) IsEmpty

func (a Int32Array) IsEmpty() bool

IsEmpty returns true if the array has no elements.

func (Int32Array) Len

func (a Int32Array) Len() int

Len implements sort.Interface.

func (Int32Array) Less

func (a Int32Array) Less(i, j int) bool

Less implements sort.Interface.

func (Int32Array) MarshalJSON

func (a Int32Array) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Int32Array) MarshalText

func (a Int32Array) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Int32Array) Scan

func (a *Int32Array) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Int32Array) String

func (a Int32Array) String() string

String returns the string representation of the Int32Array.

func (Int32Array) Swap

func (a Int32Array) Swap(i, j int)

Swap implements sort.Interface.

func (Int32Array) Unique

func (a Int32Array) Unique() Int32Array

Unique returns a new Int32Array with duplicate values removed.

func (*Int32Array) UnmarshalJSON

func (a *Int32Array) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Int32Array) UnmarshalText

func (a *Int32Array) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Int32Array) Value

func (a Int32Array) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Int64Array

type Int64Array []int64

Int64Array represents a PostgreSQL bigint array ([]bigint).

func (Int64Array) Append

func (a Int64Array) Append(vals ...int64) Int64Array

Append returns a new Int64Array with the specified values added.

func (Int64Array) AsSlice

func (a Int64Array) AsSlice() []int64

AsSlice converts the Int64Array to an int64 slice.

func (Int64Array) Contains

func (a Int64Array) Contains(val int64) bool

Contains returns true if the value exists in the array.

func (Int64Array) Equals

func (a Int64Array) Equals(b Int64Array) bool

Equals returns true if the other Int64Array has the same values in order.

func (Int64Array) Filter

func (a Int64Array) Filter(f func(int64) bool) Int64Array

Filter returns a new Int64Array with elements matching the filter.

func (Int64Array) FromSlice

func (Int64Array) FromSlice(s []int64) Int64Array

FromSlice converts an int64 slice to an Int64Array.

func (Int64Array) GormDBDataType

func (Int64Array) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (Int64Array) GormDataType

func (Int64Array) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (Int64Array) IndexOf

func (a Int64Array) IndexOf(val int64) int

IndexOf returns the index of the value, or -1 if not found.

func (Int64Array) IsEmpty

func (a Int64Array) IsEmpty() bool

IsEmpty returns true if the array has no elements.

func (Int64Array) Len

func (a Int64Array) Len() int

Len implements sort.Interface.

func (Int64Array) Less

func (a Int64Array) Less(i, j int) bool

Less implements sort.Interface.

func (Int64Array) MarshalJSON

func (a Int64Array) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Int64Array) MarshalText

func (a Int64Array) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Int64Array) Scan

func (a *Int64Array) Scan(src any) error

Scan implements the sql.Scanner interface.

func (Int64Array) String

func (a Int64Array) String() string

String returns the string representation of the Int64Array.

func (Int64Array) Swap

func (a Int64Array) Swap(i, j int)

Swap implements sort.Interface.

func (Int64Array) Unique

func (a Int64Array) Unique() Int64Array

Unique returns a new Int64Array with duplicate values removed.

func (*Int64Array) UnmarshalJSON

func (a *Int64Array) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Int64Array) UnmarshalText

func (a *Int64Array) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Int64Array) Value

func (a Int64Array) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type StringArray

type StringArray []string

StringArray represents a PostgreSQL text array ([]text).

func (StringArray) Append

func (a StringArray) Append(vals ...string) StringArray

Append returns a new StringArray with the specified values added

func (StringArray) AsStringSlice

func (a StringArray) AsStringSlice() []string

AsStringSlice returns the StringArray as a []string

func (StringArray) Contains

func (a StringArray) Contains(val string) bool

Contains returns true if the value exists in the array.

func (StringArray) Equals

func (a StringArray) Equals(b StringArray) bool

Equals returns true if the other StringArray has the same values in order.

func (StringArray) Filter

func (a StringArray) Filter(f func(string) bool) StringArray

Filter returns a new StringArray with elements matching the filter

func (StringArray) FromSlice

func (StringArray) FromSlice(s []string) StringArray

FromSlice creates a new StringArray from a []string

func (StringArray) GormDBDataType

func (StringArray) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType returns the database data type for a specific dialect

func (StringArray) GormDataType

func (StringArray) GormDataType() string

GormDataType returns the general data type

func (StringArray) IndexOf

func (a StringArray) IndexOf(val string) int

IndexOf returns the index of the value, or -1 if not found.

func (StringArray) IsEmpty

func (a StringArray) IsEmpty() bool

IsEmpty returns true if the array has no elements

func (StringArray) Len

func (a StringArray) Len() int

Len implements sort.Interface

func (StringArray) Less

func (a StringArray) Less(i, j int) bool

Less implements sort.Interface

func (StringArray) MarshalJSON

func (a StringArray) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (StringArray) MarshalText

func (a StringArray) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (*StringArray) Scan

func (a *StringArray) Scan(src any) error

Scan implements the sql.Scanner interface.

func (StringArray) String

func (a StringArray) String() string

String implements fmt.Stringer

func (StringArray) Swap

func (a StringArray) Swap(i, j int)

Swap implements sort.Interface

func (StringArray) Unique

func (a StringArray) Unique() StringArray

Unique returns a new StringArray with duplicate values removed

func (*StringArray) UnmarshalJSON

func (a *StringArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*StringArray) UnmarshalText

func (a *StringArray) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler

func (StringArray) Value

func (a StringArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type TimeArray

type TimeArray []time.Time

TimeArray represents a PostgreSQL timestamp with time zone array ([]timestamptz).

func (TimeArray) Append

func (a TimeArray) Append(vals ...time.Time) TimeArray

Append returns a new TimeArray with the specified values added.

func (TimeArray) AsSlice

func (a TimeArray) AsSlice() []time.Time

AsSlice converts the TimeArray to a time.Time slice.

func (TimeArray) Contains

func (a TimeArray) Contains(val time.Time) bool

Contains returns true if the value exists in the array.

func (TimeArray) Equals

func (a TimeArray) Equals(b TimeArray) bool

Equals returns true if the other TimeArray has the same values in order.

func (TimeArray) Filter

func (a TimeArray) Filter(f func(time.Time) bool) TimeArray

Filter returns a new TimeArray with elements matching the filter.

func (TimeArray) FromSlice

func (TimeArray) FromSlice(s []time.Time) TimeArray

FromSlice converts a time.Time slice to a TimeArray.

func (TimeArray) GormDBDataType

func (TimeArray) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (TimeArray) GormDataType

func (TimeArray) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (TimeArray) IndexOf

func (a TimeArray) IndexOf(val time.Time) int

IndexOf returns the index of the value, or -1 if not found.

func (TimeArray) IsEmpty

func (a TimeArray) IsEmpty() bool

IsEmpty returns true if the array has no elements.

func (TimeArray) Len

func (a TimeArray) Len() int

Len implements sort.Interface.

func (TimeArray) Less

func (a TimeArray) Less(i, j int) bool

Less implements sort.Interface.

func (TimeArray) MarshalJSON

func (a TimeArray) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (TimeArray) MarshalText

func (a TimeArray) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*TimeArray) Scan

func (a *TimeArray) Scan(src any) error

Scan implements the sql.Scanner interface.

func (TimeArray) String

func (a TimeArray) String() string

String returns the string representation of the TimeArray.

func (TimeArray) Swap

func (a TimeArray) Swap(i, j int)

Swap implements sort.Interface.

func (TimeArray) Unique

func (a TimeArray) Unique() TimeArray

Unique returns a new TimeArray with duplicate values removed.

func (*TimeArray) UnmarshalJSON

func (a *TimeArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*TimeArray) UnmarshalText

func (a *TimeArray) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (TimeArray) Value

func (a TimeArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type UUIDArray

type UUIDArray []uuid.UUID

UUIDArray represents a PostgreSQL uuid array ([]uuid).

func (UUIDArray) Append

func (a UUIDArray) Append(vals ...uuid.UUID) UUIDArray

Append returns a new UUIDArray with the specified values added.

func (UUIDArray) AsSlice

func (a UUIDArray) AsSlice() []uuid.UUID

AsSlice converts the UUIDArray to a uuid slice.

func (UUIDArray) Contains

func (a UUIDArray) Contains(val uuid.UUID) bool

Contains returns true if the value exists in the array.

func (UUIDArray) Equals

func (a UUIDArray) Equals(b UUIDArray) bool

Equals returns true if the other UUIDArray has the same values in order.

func (UUIDArray) Filter

func (a UUIDArray) Filter(f func(uuid.UUID) bool) UUIDArray

Filter returns a new UUIDArray with elements matching the filter.

func (UUIDArray) FromSlice

func (UUIDArray) FromSlice(s []uuid.UUID) UUIDArray

FromSlice converts a uuid slice to a UUIDArray.

func (UUIDArray) GormDBDataType

func (UUIDArray) GormDBDataType(db *gorm.DB, _ *schema.Field) string

GormDBDataType implements the gorm.DBDataTypeInterface.

func (UUIDArray) GormDataType

func (UUIDArray) GormDataType() string

GormDataType implements the gorm.DataTypeInterface.

func (UUIDArray) IndexOf

func (a UUIDArray) IndexOf(val uuid.UUID) int

IndexOf returns the index of the value, or -1 if not found.

func (UUIDArray) IsEmpty

func (a UUIDArray) IsEmpty() bool

IsEmpty returns true if the array has no elements.

func (UUIDArray) Len

func (a UUIDArray) Len() int

Len implements sort.Interface.

func (UUIDArray) Less

func (a UUIDArray) Less(i, j int) bool

Less implements sort.Interface.

func (UUIDArray) MarshalJSON

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

MarshalJSON implements the json.Marshaler interface.

func (UUIDArray) MarshalText

func (a UUIDArray) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*UUIDArray) Scan

func (a *UUIDArray) Scan(src any) error

Scan implements the sql.Scanner interface.

func (UUIDArray) String

func (a UUIDArray) String() string

String returns the string representation of the UUIDArray.

func (UUIDArray) Swap

func (a UUIDArray) Swap(i, j int)

Swap implements sort.Interface.

func (UUIDArray) Unique

func (a UUIDArray) Unique() UUIDArray

Unique returns a new UUIDArray with duplicate values removed.

func (*UUIDArray) UnmarshalJSON

func (a *UUIDArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*UUIDArray) UnmarshalText

func (a *UUIDArray) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (UUIDArray) Value

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

Value implements the driver.Valuer interface.

Jump to

Keyboard shortcuts

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