util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataTypeString = iota
	DataTypeInt
	DataTypeFloat
	DataTypeTime

	DateTimeLayout = "2006-01-02 15:04:05"
	DateLayout     = "2006-01-02"
)

Variables

View Source
var ShangHaiLocation = time.FixedZone("Asia/Shanghai", int((time.Hour * 8).Seconds()))

Functions

func CorrectColumn

func CorrectColumn(source interface{}, tp string) interface{}

func ParseValueByType

func ParseValueByType(vv interface{}, t DataType) (interface{}, error)

func RepairData

func RepairData(mp map[string]interface{}, name2Type map[string]string) ([]interface{}, string, int, error)

func TrimBoth

func TrimBoth(s, trim string) string

func TrimEnd

func TrimEnd(s, trim string) string

func TrimStart

func TrimStart(s, trim string) string

Types

type DataType

type DataType int

func ParseTypeByMysqlType

func ParseTypeByMysqlType(sqlType string) DataType

ParseTypeByMysqlType 将MySQL的数据类型转换为Go语言内部转换用的DataType

type MysqlDesc

type MysqlDesc struct {
	Field   string `db:"Field"`
	Type    string `db:"Type"`
	Null    string `db:"Null"`
	Key     string `db:"Key"`
	Default string `db:"Default"`
	Extra   string `db:"Extra"`
}

type MysqlTypeConverter

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

func NewMysqlTypeConvModel

func NewMysqlTypeConvModel(mysqlConn *sql.DB) *MysqlTypeConverter

func (*MysqlTypeConverter) ObtainMysqlTypeMap

func (tc *MysqlTypeConverter) ObtainMysqlTypeMap(tableName string) (map[string]DataType, map[string]int)

Jump to

Keyboard shortcuts

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