data_type

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatetimeLayout          = "2006-01-02 15:04:05"
	DatetimeLayoutWithSlash = "2006/01/02 15:04:05"
	DateLayout              = "2006-01-02"
	DateLayoutWithSlash     = "2006/01/02"
	DateLayout1             = "01/02/2006"
)

Variables

This section is empty.

Functions

func AppendToSlice

func AppendToSlice[T SliceType](target []T, s ...T) []T

func NewSlice

func NewSlice[T SliceType](s ...T) []T

func ScanSlice

func ScanSlice[T SliceType](v interface{}) ([]T, error)

Types

type Datetime

type Datetime struct {
	Time *time.Time
	// contains filtered or unexported fields
}

func NewDatetime

func NewDatetime(t ...interface{}) *Datetime

NewDatetime 不指定参数则用当前时间和默认格式,t[0]:可选,格式化的时间字符串,t[1]:可选解析的格式

func (Datetime) Format

func (d Datetime) Format(s string) string

Format 根据指定格式格式化

func (*Datetime) GetLayout

func (d *Datetime) GetLayout() string

func (Datetime) MarshalBinary

func (d Datetime) MarshalBinary() ([]byte, error)

func (Datetime) MarshalText

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

func (*Datetime) Scan

func (d *Datetime) Scan(v interface{}) error

func (*Datetime) SetLayout

func (d *Datetime) SetLayout(s string) *Datetime

func (Datetime) String

func (d Datetime) String() string

func (*Datetime) UnmarshalBinary

func (d *Datetime) UnmarshalBinary(b []byte) error

func (*Datetime) UnmarshalText

func (d *Datetime) UnmarshalText(b []byte) error

func (Datetime) Value

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

type Int64Slice

type Int64Slice []int64

func NewInt64Slice

func NewInt64Slice(data ...int64) *Int64Slice

func (*Int64Slice) Append

func (d *Int64Slice) Append(v ...int64)

func (Int64Slice) Len

func (d Int64Slice) Len() int

func (*Int64Slice) Scan

func (d *Int64Slice) Scan(v interface{}) (err error)

func (Int64Slice) Value

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

type MapInt64String

type MapInt64String map[int64]string

func (*MapInt64String) Scan

func (d *MapInt64String) Scan(v interface{}) (err error)

func (MapInt64String) Value

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

type SliceType

type SliceType interface {
	string | int64 | int
}

type StringSlice

type StringSlice []string

func NewStringSlice

func NewStringSlice(data ...string) *StringSlice

func (*StringSlice) Append

func (d *StringSlice) Append(v ...string)

func (StringSlice) Len

func (d StringSlice) Len() int

func (*StringSlice) Scan

func (d *StringSlice) Scan(v interface{}) (err error)

func (StringSlice) Value

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

Jump to

Keyboard shortcuts

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