libs

package
v0.0.0-...-7d52337 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProjectName = "MySQL-Model-Creator"
	Version     = "0.9"
	ProjectURL  = "https://github.com/laixyz/mysql-model-creator"
)

Variables

View Source
var FieldTypes map[string]bool = map[string]bool{"ArrayString": true}

Functions

func Exec

func Exec()

func FileWrite

func FileWrite(filePath string, content string) error

func GetCode

func GetCode(table MysqlTable, packageName string) string

func GetDeleteFunc

func GetDeleteFunc(table MysqlTable) string

func GetPackageName

func GetPackageName(Path string) (string, error)

通过实际路径,得到包名

func GetSaveFunc

func GetSaveFunc(table MysqlTable) string

func GetStructMethod

func GetStructMethod(table MysqlTable) string

func GetTableComment

func GetTableComment(db *sqlx.DB, tableName string) (string, string)

func GetUpdateFunc

func GetUpdateFunc(table MysqlTable) string

func TableToConst

func TableToConst(table MysqlTable) string

Types

type MysqlTable

type MysqlTable struct {
	TableName       string
	Alias           string
	Comment         string
	Fields          []MysqlTableField
	FiledName       []string
	IsOnlyPrimary   bool
	PrimaryKeyField string
	Doc             string
	HasTime         bool
	IsModel         bool
	HasState        bool
	HasCreated      bool
	HasUpdated      bool
	HasDeleted      bool
	ConnectID       string
}

func GetTables

func GetTables(db *sqlx.DB, ConnectID string) (tables []MysqlTable, err error)

type MysqlTableField

type MysqlTableField struct {
	Field      string         `db:"Field"`
	Type       string         `db:"Type"`
	Collation  sql.NullString `db:"Collation"`
	Null       string         `db:"Null"`
	Key        string         `db:"Key"`
	Default    sql.NullString `db:"Default"`
	Extra      string         `db:"Extra"`
	Privileges string         `db:"Privileges"`
	Comment    string         `db:"Comment"`
}

func GetTable

func GetTable(db *sqlx.DB, tableName string) (fields []MysqlTableField, err error)

Jump to

Keyboard shortcuts

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