datatypes

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UTC               = time.UTC
	CST               = time.FixedZone("CST", 8*60*60)
	TimestampZero     = Timestamp(time.Time{})
	TimestampUnixZero = Timestamp(time.Unix(0, 0))
)
View Source
var (
	DatetimeZero = Datetime(time.Time{})
)

Functions

func JSONScan

func JSONScan(dbValue interface{}, value interface{}) error

func JSONValue

func JSONValue(value interface{}) (driver.Value, error)

Types

type Bool

type Bool int

openapi:type boolean

const (
	BOOL_UNKNOWN Bool = iota
	BOOL_TRUE         // true
	BOOL_FALSE        // false
)

func (Bool) MarshalJSON

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

func (Bool) MarshalText

func (v Bool) MarshalText() ([]byte, error)

func (*Bool) UnmarshalJSON

func (v *Bool) UnmarshalJSON(data []byte) (err error)

func (*Bool) UnmarshalText

func (v *Bool) UnmarshalText(data []byte) (err error)

type Datetime

type Datetime time.Time

openapi:strfmt date-time

func ParseDatetimeFromString

func ParseDatetimeFromString(s string) (dt Datetime, err error)

func ParseDatetimeFromStringWithFormatterInCST

func ParseDatetimeFromStringWithFormatterInCST(s, formatter string) (dt Datetime, err error)

func (Datetime) DataType

func (Datetime) DataType(e string) string

func (Datetime) Format

func (dt Datetime) Format(layout string) string

func (Datetime) In

func (dt Datetime) In(loc *time.Location) Datetime

func (Datetime) IsZero

func (dt Datetime) IsZero() bool

func (Datetime) MarshalText

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

func (*Datetime) Scan

func (dt *Datetime) Scan(value interface{}) error

func (Datetime) String

func (dt Datetime) String() string

func (Datetime) Unix

func (dt Datetime) Unix() int64

func (*Datetime) UnmarshalText

func (dt *Datetime) UnmarshalText(data []byte) (err error)

func (Datetime) Value

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

type MySQLDatetime

type MySQLDatetime = Datetime

type MySQLTimestamp

type MySQLTimestamp = Timestamp

type OperateTime

type OperateTime struct {
	// 创建时间
	CreatedAt MySQLTimestamp `db:"f_created_at,default='0'" json:"createdAt" `
	// 更新时间
	UpdatedAt MySQLTimestamp `db:"f_updated_at,default='0'" json:"updatedAt"`
	// 删除时间
	DeletedAt MySQLTimestamp `db:"f_deleted_at,default='0'" json:"-"`
}

type PrimaryID

type PrimaryID struct {
	ID uint64 `db:"F_id,autoincrement" json:"-"`
}

type ReserveFields

type ReserveFields struct {
	// 预留整数1
	ReserveInt1 int32 `db:"F_reserve_int1" json:"-" sql:"int(32) NOT NULL DEFAULT '0'"`
	// 预留整数2
	ReserveInt2 int32 `db:"F_reserve_int2" json:"-" sql:"int(32) NOT NULL DEFAULT '0'"`
	// 预留字符串1
	ReserveString1 string `db:"F_reserve_string1" json:"-" sql:"varchar(255) NOT NULL DEFAULT ''"`
	// 预留字符串2
	ReserveString2 string `db:"F_reserve_string2" json:"-" sql:"varchar(255) NOT NULL DEFAULT ''"`
}

type SoftDelete

type SoftDelete struct {
	Enabled enumeration.Bool `db:"F_enabled" sql:"int(8) unsigned NOT NULL DEFAULT '1'" json:"-"`
}

func (*SoftDelete) Disable

func (e *SoftDelete) Disable()

func (*SoftDelete) Enable

func (e *SoftDelete) Enable()

type Timestamp

type Timestamp time.Time

openapi:strfmt date-time

func ParseTimestampFromString

func ParseTimestampFromString(s string) (dt Timestamp, err error)

func ParseTimestampFromStringWithLayout

func ParseTimestampFromStringWithLayout(input, layout string) (Timestamp, error)

func (*Timestamp) DataType

func (dt *Timestamp) DataType(engine string) string

func (Timestamp) Format

func (dt Timestamp) Format(layout string) string

func (Timestamp) In

func (dt Timestamp) In(loc *time.Location) Timestamp

func (Timestamp) IsZero

func (dt Timestamp) IsZero() bool

func (Timestamp) MarshalText

func (dt Timestamp) MarshalText() ([]byte, error)

func (*Timestamp) Scan

func (dt *Timestamp) Scan(value interface{}) error

func (Timestamp) String

func (dt Timestamp) String() string

func (Timestamp) Unix

func (dt Timestamp) Unix() int64

func (*Timestamp) UnmarshalText

func (dt *Timestamp) UnmarshalText(data []byte) (err error)

func (Timestamp) Value

func (dt Timestamp) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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