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 ¶ added in v1.2.0
type ApiTplAnalysisRes struct { PackageName string PackagePascalName string TplAnalysisList []TplAnalysisItem }
type CommonConfig ¶ added in v1.2.0
type CommonConfig struct { PackageName string // 包名 TplDir string // 模板目录 RootDir string // 生成文件的根目录 LayerDirMap map[LayerName]string // 各层级目录,如果为空则使用默认规则 LayerNameMap map[LayerName]LayerName // 各层级名称,如果为空则使用默认规则 LayerPrefixMap map[LayerName]LayerPrefix // 各层级前缀,如果为空则使用默认规则 TplFuncMap template.FuncMap // 模板函数 }
type GenParams ¶ added in v1.2.0
type GenParams struct {
ParamsList []GenParamsItem
}
type GenParamsItem ¶ added in v1.2.0
type Generator ¶ added in v1.2.0
type Generator interface { AnalysisModuleTpl(db *gorm.DB, cfg *ModuleCfg) (*ModuleTplAnalysisRes, error) AnalysisApiTpl(cfg *ApiCfg) (*ApiTplAnalysisRes, error) Gen(params *GenParams) error }
func NewGenerator ¶ added in v1.2.0
func NewGenerator() Generator
type LayerName ¶ added in v1.2.0
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" LayerNameErrorCode LayerName = "errorCode" LayerNameObject LayerName = "object" )
type LayerPrefix ¶ added in v1.2.0
type LayerPrefix string
func (LayerPrefix) String ¶ added in v1.2.0
func (lp LayerPrefix) String() string
type ModelField ¶
type ModelField struct { FieldName string // 字段名称 FieldType string // 字段数据类型,如int、string ColumnName string // 列名 ColumnType string // 列数据类型,如varchar(255) ColumnSize int // 字段长度 IsNull bool // 是否允许为空 DefaultValue string // 默认值 ColumnKey string // 索引类型 Comment string // 字段注释 NumericPrecision int64 // 数值列的精度 NumericScale int64 // 数值列的小数位数 DatetimePrecision int64 // 日期时间列的精度 }
type ModuleCfg ¶
type ModuleCfg struct { CommonConfig TableName string `validate:"required"` // 表名 ColumnTypeMap map[string]string // 表字段类型映射,入股为空则使用默认规则 }
type ModuleTplAnalysisItem ¶ added in v1.2.0
type ModuleTplAnalysisItem struct { TplAnalysisItem ModelFields []ModelField }
type ModuleTplAnalysisRes ¶ added in v1.2.0
type ModuleTplAnalysisRes struct { PackageName string TableName string PackagePascalName string StructName string TplAnalysisList []ModuleTplAnalysisItem }
Click to show internal directories.
Click to hide internal directories.