modelgen

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdModelCommand

func CmdModelCommand(c *cli.Context) error

func FileModelCommand

func FileModelCommand(c *cli.Context) error

Types

type Config

type Config struct {
	// 是否需要生成redis缓存代码逻辑
	WithCache bool
	// 是否强制覆盖已有文件,如果是将导致原已修改文件找不回
	Force bool
	// mysql访问用户
	Username string
	// mysql访问密码
	Password string
	// mysql连接地址
	Address string
	// 库名
	TableSchema string
	// 待生成model所依赖的表
	Tables []string `json:"Tables,omitempty"`
}

type Field

type Field struct {
	// 字段名称,下划线
	Name string `db:"name"`
	// 字段数据类型
	Type string `db:"type"`
	// 字段顺序
	Position int `db:"position"`
	// 字段注释
	Comment string `db:"comment"`
	// key
	Primary string `db:"k"`
}

type FieldModel

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

func NewFieldModel

func NewFieldModel(dataSource, table string) *FieldModel

type Query

type Query struct {
	Rows   string
	Args   string
	Values string
}

type StructField

type StructField struct {
	// 字段名称,下划线
	NameWithUnderline string
	// 字段名称,驼峰式,大写开头
	NameCamelWithUpperStart string
	// 字段数据类型
	DataType string
	// 字段注释
	Comment string
	// 是否为主键
	PrimaryKey bool
}

type Table

type Table struct {
	Name string `db:"name"`
}

type Template

type Template struct {
	Package                  string
	PrimaryKeyField          string
	PrimaryKeyFieldCamel     string
	PrimaryKeyType           string
	ModelCamelWithLowerStart string
	ModelLowerSplitByPound   string
	ModelCamelWithUpperStart string
	Fields                   string
	Abbr                     string
	WithCache                bool
	Insert                   Query
	// 包含where语句
	Update Update
}

type Update

type Update struct {
	Rows   string
	Values string
}

Jump to

Keyboard shortcuts

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