datatypes

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: MIT, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Array

type Array[T any] []T

Array represents a PostgreSQL array for T. It implements the ArrayGetter and ArraySetter interfaces. It preserves PostgreSQL dimensions and custom lower bounds. Use FlatArray if these are not needed. only support number

func (*Array[T]) Scan

func (d *Array[T]) Scan(value any) error

func (Array[T]) Value

func (d Array[T]) Value() (driver.Value, error)

type FloatArray

type FloatArray[T constraints.Float] []T

func (*FloatArray[T]) Scan

func (d *FloatArray[T]) Scan(value any) error

func (FloatArray[T]) Value

func (d FloatArray[T]) Value() (driver.Value, error)

type IntArray

type IntArray[T constraints.Integer] []T

adpter postgres

func (*IntArray[T]) Scan

func (d *IntArray[T]) Scan(value any) error

func (IntArray[T]) Value

func (d IntArray[T]) Value() (driver.Value, error)

type Json

type Json[T any] struct {
	V T
}

func (*Json[T]) Scan

func (j *Json[T]) Scan(value interface{}) error

实现 sql.Scanner 接口,Scan 将 value 扫描至 Json

func (*Json[T]) Value

func (j *Json[T]) Value() (driver.Value, error)

实现 driver.Valuer 接口,Value 返回 json value

type MapJson

type MapJson[T any] map[string]T

func (*MapJson[T]) Scan

func (j *MapJson[T]) Scan(value interface{}) error

实现 sql.Scanner 接口,Scan 将 value 扫描至 Json

func (MapJson[T]) Value

func (j MapJson[T]) Value() (driver.Value, error)

实现 driver.Valuer 接口,Value 返回 json value

type Null

type Null[T any] sql.Null[T]

func (Null[T]) MarshalJSON

func (n Null[T]) MarshalJSON() ([]byte, error)

func (*Null[T]) Scan

func (n *Null[T]) Scan(value any) error

func (*Null[T]) UnmarshalJSON

func (n *Null[T]) UnmarshalJSON(data []byte) error

func (Null[T]) Value

func (n Null[T]) Value() (driver.Value, error)

type NullJson

type NullJson[T any] struct {
	V     T
	Valid bool
}

func (*NullJson[T]) GormDataType

func (*NullJson[T]) GormDataType() string

func (*NullJson[T]) Scan

func (j *NullJson[T]) Scan(value interface{}) error

实现 sql.Scanner 接口,Scan 将 value 扫描至 Json

func (*NullJson[T]) Value

func (j *NullJson[T]) Value() (driver.Value, error)

实现 driver.Valuer 接口,Value 返回 json value

type RawJson

type RawJson []byte

func (*RawJson) GormDataType

func (*RawJson) GormDataType() string

func (*RawJson) Scan

func (j *RawJson) Scan(value interface{}) error

实现 sql.Scanner 接口,Scan 将 value 扫描至 RawJson

func (RawJson) Value

func (j RawJson) Value() (driver.Value, error)

实现 driver.Valuer 接口,Value 返回 json value

type StringArray

type StringArray []string

func (*StringArray) Scan

func (d *StringArray) Scan(value any) error

func (StringArray) Value

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

type TimeArray

type TimeArray []time.Time

func (*TimeArray) Scan

func (d *TimeArray) Scan(value any) error

func (TimeArray) Value

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

Jump to

Keyboard shortcuts

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