model

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentPath

func GetCurrentPath() string

func GetModuleName

func GetModuleName() (string, string)

func GetRelativePath

func GetRelativePath() string

func GoCamelCase

func GoCamelCase(s string) string

func GoModFilePath

func GoModFilePath() string

func GoTypeToProtoType

func GoTypeToProtoType(g string) string

func GoTypeToTypeScriptDefaultValue added in v1.0.9

func GoTypeToTypeScriptDefaultValue(g string) string

func Incr

func Incr(x int) int

func IsNumber

func IsNumber(arg string) bool

func MysqlToGoFieldType

func MysqlToGoFieldType(dt, ct string) (string, int)

MysqlToGoFieldType MysqlToGoFieldType

func SQLTool

func SQLTool(t *Table, flag string) string

SQLTool SQLTool

Types

type Column

type Column struct {
	OrdinalPosition           int    // field_ordinal
	ColumnName                string // column_name
	DataType                  string // data_type
	ColumnType                string // column_type
	ColumnComment             string // column_comment,
	NotNull                   bool   // not_null
	IsPrimaryKey              bool   // is_primary_key
	IsAutoIncrment            bool   // is_auto_incrment
	IsDefaultCurrentTimestamp bool   // is_default_currenttimestamp
	GoColumnName              string // go field name
	GoColumnType              string // go field type
	BigType                   int    // 0 表示不生成where 1 表示比较类型 2表示比较类型+字符串 3表示比较类型,修改传入参数
	GoConditionType           string // 生成where 的类型参数
	ProtoType                 string // protoType
}

Column Column

func MysqlColumn

func MysqlColumn(ddl *sqlparser.DDL) ([]*Column, error)

type Table

type Table struct {
	Database         string
	TableName        string    // table name
	GoTableName      string    // go struct name
	PackageName      string    // package name
	Fields           []*Column // columns
	GenerateWhereCol []*Column // GenerateWhereCol 生成where字段比较方法的列
	PrimaryKey       *Column   // priomary_key column
	ImportTime       bool      // is need import time
	RelativePath     string
	Protopkg         string
}

Table Table

func MysqlTable

func MysqlTable(db, path, relative string) *Table

Jump to

Keyboard shortcuts

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