Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStructNames ¶
func GetStructNames(bases []*StructMeta) (names []string)
GetStructNames get struct names from base structs
Types ¶
type ITableInfo ¶
type ITableInfo interface { GetTableColumns(schemaName string, tableName string) (result []*model.Column, err error) GetTableIndex(schemaName string, tableName string) (indexes []gorm.Index, err error) }
ITableInfo table info interface
type StructMeta ¶ added in v1.0.0
type StructMeta struct { Generated bool // whether to generate db model FileName string // generated file name S string // the first letter(lower case)of simple Name (receiver) QueryStructName string // internal query struct name ModelStructName string // origin/model struct name TableName string // table name in db server TableComment string // table comment in db server Fields []*model.Field ImportPkgPaths []string TemplatePkgPath map[string]string // 模板的包路径 PkgPath string // package's path: internal/model Package string // package's name: model Type string // param's type: User ConvTypeMap map[string]string ConvTypePkgMap map[string]string DynamicConstSuffixes []string // dynamic const suffix AutoValueFields map[string]struct{} // dynamic const suffix FieldWithTags []string SubMatch []string Params map[string]interface{} // 参数 // contains filtered or unexported fields }
func ConvertStructs ¶
func ConvertStructs(db *gorm.DB, structs ...interface{}) (metas []*StructMeta, err error)
ConvertStructs convert to base structures
func GetStructMeta ¶ added in v1.0.0
GetStructMeta generate db model by table name
Click to show internal directories.
Click to hide internal directories.