generate

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 12 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 CTLTplType added in v1.0.1

type CTLTplType string

CTLTplType 控制器模板类型

const (
	// DefaultCtlTpl 默认swagger模板
	DefaultCtlTpl CTLTplType = "default"
	// TBCtlTpl 基于teambition的swagger模板
	TBCtlTpl CTLTplType = "tb"
)

func NewCTLTplType added in v1.0.1

func NewCTLTplType(s string) CTLTplType

NewCTLTplType 创建控制器模板

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
	CtlTpl     string
	RouterName string
	Name       string
	Comment    string
	File       string
	Modules    string
}

Config 配置参数

type TplFieldItem

type TplFieldItem struct {
	StructFieldName     string `json:"struct_field_name"`     // 结构体字段名称
	StructFieldRequired bool   `json:"struct_field_required"` // 结构字段必选项
	Comment             string `json:"comment"`               // 注释
	StructFieldType     string `json:"struct_field_type"`     // 结构体字段类型
	GormOptions         string `json:"gorm_options"`          // gorm配置项
	BindingOptions      string `json:"binding_options"`       // binding配置项
}

TplFieldItem 模板字段项

type TplItem

type TplItem struct {
	StructName string         `json:"struct_name"` // 结构体名称
	Comment    string         `json:"comment"`     // 注释
	Fields     []TplFieldItem `json:"fields"`      // 字段项
}

TplItem 模板项

Jump to

Keyboard shortcuts

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