generate

package
v1.0.23 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(cfg Config) error

Exec 执行生成模块命令

Types

type Command

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

Command 生成命令

func (*Command) Exec

func (a *Command) Exec() error

Exec 执行命令

type Config

type Config struct {
	Dir        string
	PkgName    string
	Name       string
	Comment    string
	File       string
	Storage    string
	Modules    string
	ApiVersion string
	GenPkg     string
}

Config 配置参数

type TplFieldItem

type TplFieldItem struct {
	StructFieldName     string `yaml:"name"`            // 结构体字段名称
	StorageKey          string `yaml:"storage"`         // 数据库存储字段名称
	StructFieldRequired bool   `yaml:"required"`        // 结构字段必选项
	Comment             string `yaml:"comment"`         // 注释
	StructFieldType     string `yaml:"type"`            // 结构体字段类型
	GormOptions         string `yaml:"gorm_options"`    // gorm配置项
	BindingOptions      string `yaml:"binding_options"` // binding配置项
	Max                 int    `yaml:"max"`             // 字符串最长, 数字类型最大
	Min                 int    `yaml:"min"`             // 字符串最短, 数字类型最小
	Default             string `yaml:"default"`         // 默认值
	Index               string `yaml:"index"`           // 数据库索引
}

TplFieldItem 模板字段项

type TplItem

type TplItem struct {
	StructName string         `yaml:"name"`    // 结构体名称
	Comment    string         `yaml:"comment"` // 注释
	Mixin      string         `yaml:"mixin"`   // memo, sort, time, status, active
	Fields     []TplFieldItem `yaml:"fields"`  // 字段项
}

TplItem 模板项

Jump to

Keyboard shortcuts

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