data_type

package
v0.0.0-...-61829c1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 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

	EnumType string
	Enums    map[int][]string

	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 ZeroCheck

type ZeroCheck interface {
	IsZero() bool
}

Jump to

Keyboard shortcuts

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