Documentation
¶
Index ¶
Constants ¶
View Source
const (
ColumnKeyPRI = "PRI" // 主键
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiCfg ¶
type ApiCfg struct {
CommonConfig
TargetFilename string // 目标文件名
}
type ApiTplAnalysisRes ¶
type ApiTplAnalysisRes struct {
PackageName string
TplAnalysisList []TplAnalysisItem
}
type CommonConfig ¶
type CommonConfig struct {
PackageName string // 包名
TplDir string // 模板目录
RootDir string // 生成文件的根目录
LayerParentDirMap map[LayerName]string // 各层级父目录,如果为空则使用默认规则
LayerNameMap map[LayerName]LayerName // 各层级名称,如果为空则使用默认规则
LayerPrefixMap map[LayerName]LayerPrefix // 各层级前缀,如果为空则使用默认规则
TplFuncMap template.FuncMap // 模板函数
}
type GenParams ¶
type GenParams struct {
ParamsList []GenParamsItem
}
type GenParamsItem ¶
type Generator ¶
type Generator interface {
AnalysisModuleTpl(db *gorm.DB, cfg *ModuleCfg) (*ModuleTplAnalysisRes, error)
AnalysisApiTpl(cfg *ApiCfg) (*ApiTplAnalysisRes, error)
Gen(params *GenParams) error
}
func NewGenerator ¶
func NewGenerator() Generator
type LayerName ¶
type LayerName string
const ( LayerNameRouter LayerName = "router" LayerNameController LayerName = "controller" LayerNameService LayerName = "service" LayerNameDto LayerName = "dto" LayerNameRequest LayerName = "request" LayerNameResponse LayerName = "response" LayerNameModel LayerName = "model" LayerNameDao LayerName = "dao" LayerNameCode LayerName = "code" LayerNameObject LayerName = "object" )
type LayerPrefix ¶
type LayerPrefix string
func (LayerPrefix) String ¶
func (lp LayerPrefix) String() string
type ModelField ¶
type ModuleCfg ¶
type ModuleCfg struct {
CommonConfig
TableName string `validate:"required"` // 表名
ColumnTypeMap map[string]string // 表字段类型映射,入股为空则使用默认规则
}
type ModuleTplAnalysisItem ¶
type ModuleTplAnalysisItem struct {
TplAnalysisItem
ModelFields []ModelField
}
type ModuleTplAnalysisRes ¶
type ModuleTplAnalysisRes struct {
PackageName string
TableName string
StructName string
TplAnalysisList []ModuleTplAnalysisItem
}
Click to show internal directories.
Click to hide internal directories.