types

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arr2Pg

func Arr2Pg(arr []bool) pgtype.BoolArray

func Arr2Pg16

func Arr2Pg16(arr []int16) pgtype.Int2Array

func Arr2Pg32

func Arr2Pg32(arr []int32) pgtype.Int4Array

func Arr2Pg64

func Arr2Pg64(arr []int64) pgtype.Int8Array

func NewBool

func NewBool(b bool) *bool

func NewInt

func NewInt[T constraints.Integer](i T) *int

func NewInt16

func NewInt16[T constraints.Integer](i T) *int16

func NewInt32

func NewInt32[T constraints.Integer](i T) *int32

func NewInt64

func NewInt64[T constraints.Integer](i T) *int64

func NewInt8

func NewInt8[T constraints.Integer](i T) *int8

func NewString

func NewString(i string) *string

func Pg2Arr

func Pg2Arr(v pgtype.BoolArray) []bool

func Pg2Arr16

func Pg2Arr16(v pgtype.Int2Array) []int16

func Pg2Arr32

func Pg2Arr32(v pgtype.Int4Array) []int32

func Pg2Arr64

func Pg2Arr64(v pgtype.Int8Array) []int64

func V4

func V4() uuid.UUID

func V4p

func V4p() *uuid.UUID

Types

type Array

type Array struct {
	// contains filtered or unexported fields
}

func ArrayOf

func ArrayOf(v ...any) Array

func (Array) Value

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

type AutoDateTime

type AutoDateTime struct {
	time.Time
}

datetime

func (AutoDateTime) MarshalJSON

func (t AutoDateTime) MarshalJSON() ([]byte, error)

func (*AutoDateTime) Scan

func (t *AutoDateTime) Scan(v any) error

Scan valueof jstime.Time

func (*AutoDateTime) UnmarshalJSON

func (t *AutoDateTime) UnmarshalJSON(data []byte) error

func (AutoDateTime) Value

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

Value insert timestamp into mysql need this function.

type Date

type Date struct {
	time.Time
}

date

func DateOf

func DateOf(t time.Time) Date

func DateOfYmd

func DateOfYmd(year, month, day int) Date

func DatePOf

func DatePOf(t time.Time) *Date

func DatePOfYmd

func DatePOfYmd(year, month, day int) *Date

func NowDate

func NowDate() Date

func NowDateP

func NowDateP() *Date

func (Date) Add

func (t Date) Add(d *DurationOption) Date

func (Date) AddTime

func (d Date) AddTime(t Time) DateTime

func (Date) After

func (t Date) After(d Date) bool

After t>d 返回true t<=d 返回false

func (Date) Before

func (t Date) Before(d Date) bool

Before t<d 返回true t>=d 返回false

func (Date) MarshalJSON

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

func (*Date) Scan

func (t *Date) Scan(v any) error

Scan valueof jstime.Time

func (Date) ToDateTime

func (t Date) ToDateTime() DateTime

func (Date) ToDateTimeP

func (t Date) ToDateTimeP() *DateTime

func (Date) ToGoTime

func (t Date) ToGoTime() time.Time

func (Date) ToString

func (t Date) ToString() string

func (*Date) UnmarshalJSON

func (t *Date) UnmarshalJSON(data []byte) error

func (Date) Value

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

Value insert timestamp into mysql need this function.

type DateList

type DateList []Date

func (*DateList) Scan

func (p *DateList) Scan(data any) error

Scan 实现方法

func (DateList) Value

func (p DateList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type DateTime

type DateTime struct {
	time.Time
}

datetime

func NowDateTime

func NowDateTime() DateTime

func NowDateTimeP

func NowDateTimeP() *DateTime

func (DateTime) Add

func (t DateTime) Add(d *DurationOption) DateTime

func (DateTime) MarshalJSON

func (t DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) Scan

func (t *DateTime) Scan(v any) error

Scan valueof jstime.Time

func (DateTime) ToDate

func (t DateTime) ToDate() Date

func (DateTime) ToDateP

func (t DateTime) ToDateP() *Date

func (DateTime) ToGoTime

func (t DateTime) ToGoTime() time.Time

func (DateTime) ToString

func (t DateTime) ToString() string

func (*DateTime) UnmarshalJSON

func (t *DateTime) UnmarshalJSON(data []byte) error

func (DateTime) Value

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

Value insert timestamp into mysql need this function.

type DateTimeList

type DateTimeList []DateTime

func (*DateTimeList) Scan

func (p *DateTimeList) Scan(data any) error

Scan 实现方法

func (DateTimeList) Value

func (p DateTimeList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type DecimalList

type DecimalList []decimal.Decimal

func (*DecimalList) Scan

func (p *DecimalList) Scan(data any) error

Scan 实现方法

func (DecimalList) Value

func (p DecimalList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type DurationOption

type DurationOption struct {
	// contains filtered or unexported fields
}

func Duration

func Duration() *DurationOption

func (*DurationOption) Day

func (d *DurationOption) Day(day int) *DurationOption

func (*DurationOption) Hour

func (d *DurationOption) Hour(hour int) *DurationOption

func (*DurationOption) Min

func (d *DurationOption) Min(min int) *DurationOption

func (*DurationOption) Month

func (d *DurationOption) Month(month int) *DurationOption

func (*DurationOption) Nsec

func (d *DurationOption) Nsec(nsec int) *DurationOption

func (*DurationOption) Sec

func (d *DurationOption) Sec(sec int) *DurationOption

func (*DurationOption) Year

func (d *DurationOption) Year(year int) *DurationOption

type Fields

type Fields []string

type IntList

type IntList []int

func (*IntList) Scan

func (p *IntList) Scan(data any) error

Scan 实现方法

func (IntList) Value

func (p IntList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type StringList

type StringList []string

func (StringList) Len

func (p StringList) Len() int

func (StringList) Less

func (p StringList) Less(i, j int) bool

实现Less方法

func (*StringList) Scan

func (p *StringList) Scan(data any) error

Scan 实现方法

func (StringList) Swap

func (p StringList) Swap(i, j int)

实现Swap方法

func (StringList) Value

func (p StringList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type Time

type Time struct {
	time.Time
}

func NowTime

func NowTime() Time

func NowTimeP

func NowTimeP() *Time

func TimeOf

func TimeOf(t time.Time) Time

func TimeOfHms

func TimeOfHms(hour, min, sec int) Time

func TimePOf

func TimePOf(t time.Time) *Time

func TimePOfHms

func TimePOfHms(hour, min, sec int) *Time

func (Time) Add

func (t Time) Add(d *DurationOption) Time

func (Time) AddData

func (t Time) AddData(d Date) DateTime

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

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

func (Time) ToDateTime

func (t Time) ToDateTime() DateTime

func (Time) ToDateTimeP

func (t Time) ToDateTimeP() *DateTime

func (Time) ToGoTime

func (t Time) ToGoTime() time.Time

func (Time) ToString

func (t Time) ToString() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

func (Time) Value

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

type TimeList

type TimeList []Time

func (*TimeList) Scan

func (p *TimeList) Scan(data any) error

Scan 实现方法

func (TimeList) Value

func (p TimeList) Value() (driver.Value, error)

gorm 自定义结构需要实现 Value Scan 两个方法 Value 实现方法

type UUID

type UUID uuid.UUID

func NewV4

func NewV4() UUID

func NewV4P

func NewV4P() *UUID

func Str2UUID

func Str2UUID(v string) (UUID, error)

func Str2UUIDMust

func Str2UUIDMust(v string) UUID

func Str2UUIDMustP

func Str2UUIDMustP(v string) *UUID

func (UUID) MarshalJSON

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

func (*UUID) Scan

func (u *UUID) Scan(v any) error

Scan valueof time.Time

func (UUID) String

func (u UUID) String() string

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(src []byte) error

func (UUID) Value

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

type UUIDList

type UUIDList []UUID

func (*UUIDList) Scan

func (p *UUIDList) Scan(data any) error

Scan 实现方法

func (UUIDList) Value

func (p UUIDList) Value() (driver.Value, error)

Value 实现方法

Jump to

Keyboard shortcuts

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