datatypes

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UTC                    = time.UTC
	CST                    = time.FixedZone("CST", 8*60*60)
	MySQLTimestampZero     = MySQLTimestamp(time.Time{})
	MySQLTimestampUnixZero = MySQLTimestamp(time.Unix(0, 0))
)
View Source
var (
	MySQLDatetimeZero = MySQLDatetime(time.Time{})
)
View Source
var ValueKeywords = map[string]bool{
	"NULL":              true,
	"CURRENT_TIMESTAMP": true,
}

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 ColumnType

type ColumnType struct {
	// type
	DataType
	// length
	Length int64
	// 小数点位数
	Decimal int64
	// todo enum 值 or set
	Values   []string
	Unsigned bool
	// [CHARACTER SET utf8 when text] COLLATE utf8_bin
	Charset string
	Collate string

	Zerofill bool
	NotNull  bool

	Enum enumeration.Enum

	HasDefault bool
	Default    string

	// extra
	AutoIncrement              bool
	OnUpdateByCurrentTimestamp bool

	Comment string
}

func ParseColumnType

func ParseColumnType(sql string) (columnType *ColumnType, err error)

func (ColumnType) DeAlias

func (columnType ColumnType) DeAlias() *ColumnType

func (ColumnType) IsEnum

func (columnType ColumnType) IsEnum() bool

func (ColumnType) String

func (columnType ColumnType) String() string

type DataType

type DataType string

func (DataType) Is

func (dataType DataType) Is(dataTypes []DataType) bool

func (DataType) IsBlob

func (dataType DataType) IsBlob() bool

func (DataType) IsChar

func (dataType DataType) IsChar() bool

func (DataType) IsDate

func (dataType DataType) IsDate() bool

func (DataType) IsEnum

func (dataType DataType) IsEnum() bool

func (DataType) IsFixed

func (dataType DataType) IsFixed() bool

func (DataType) IsFloating

func (dataType DataType) IsFloating() bool

func (DataType) IsInteger

func (dataType DataType) IsInteger() bool

func (DataType) IsSet

func (dataType DataType) IsSet() bool

func (DataType) IsText

func (dataType DataType) IsText() bool

func (DataType) String

func (dataType DataType) String() string

func (DataType) WithArgs

func (dataType DataType) WithArgs(args ...string) string

type MySQLDatetime

type MySQLDatetime time.Time

swagger:strfmt date-time

func ParseMySQLDatetimeFromString

func ParseMySQLDatetimeFromString(s string) (dt MySQLDatetime, err error)

func ParseMySQLDatetimeFromStringWithFormatterInCST

func ParseMySQLDatetimeFromStringWithFormatterInCST(s, formatter string) (dt MySQLDatetime, err error)

func (MySQLDatetime) Format

func (dt MySQLDatetime) Format(layout string) string

func (MySQLDatetime) In

func (MySQLDatetime) IsZero

func (dt MySQLDatetime) IsZero() bool

func (MySQLDatetime) MarshalText

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

func (*MySQLDatetime) Scan

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

func (MySQLDatetime) String

func (dt MySQLDatetime) String() string

func (MySQLDatetime) Unix

func (dt MySQLDatetime) Unix() int64

func (*MySQLDatetime) UnmarshalText

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

func (MySQLDatetime) Value

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

type MySQLTimestamp

type MySQLTimestamp time.Time

openapi:strfmt date-time

func ParseMySQLTimestampFromString

func ParseMySQLTimestampFromString(s string) (dt MySQLTimestamp, err error)

func ParseMySQLTimestampFromStringWithLayout

func ParseMySQLTimestampFromStringWithLayout(input, layout string) (MySQLTimestamp, error)

func (MySQLTimestamp) Format

func (dt MySQLTimestamp) Format(layout string) string

func (MySQLTimestamp) In

func (MySQLTimestamp) IsZero

func (dt MySQLTimestamp) IsZero() bool

func (MySQLTimestamp) MarshalText

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

func (*MySQLTimestamp) Scan

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

func (MySQLTimestamp) String

func (dt MySQLTimestamp) String() string

func (MySQLTimestamp) Unix

func (dt MySQLTimestamp) Unix() int64

func (*MySQLTimestamp) UnmarshalText

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

func (MySQLTimestamp) Value

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

Jump to

Keyboard shortcuts

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