Versions in this module Expand all Collapse all v1 v1.0.0 Sep 8, 2020 Changes in this version + func CheckFields(table *builder.Table, fieldNames ...string) (cols builder.Columns, err error) + func ForEachField(typeStruct *types.Struct, cb func(field *types.Var)) + func IndirectType(tpe types.Type) (types.Type, error) + func WithDefaults(dataType string, withDefaults bool, defaultValue string) string + type Config struct + ConstSoftDeleteFalse string + ConstSoftDeleteTrue string + Database string + FieldCreatedAt string + FieldPrimaryKey string + FieldSoftDelete string + FieldUpdatedAt string + StructName string + TableName string + WithComments bool + WithTableInterfaces bool + func (g *Config) Defaults() + type Keys struct + Indexes sqlx.Indexes + Primary sqlx.FieldNames + UniqueIndexes sqlx.Indexes + func (ks *Keys) Bind(table *builder.Table) + func (ks *Keys) PatchUniqueIndexesWithSoftDelete(softDeleteField string) + type Model struct + FieldAutoIncrement string + Fields map[string]*types.Var + HasAutoIncrement bool + HasCreatedAt bool + HasSoftDelete bool + HasUpdatedAt bool + func NewModel(prog *loader.Program, typeName *types.TypeName, comments string, cfg *Config) *Model + func (m *Model) AddColumn(col *builder.Column, tpe *types.Var) + func (m *Model) EnableIfNeed() string + func (m *Model) FieldType(name string) (typ string) + func (m *Model) GetComments() map[string]string + func (m *Model) IndexFieldNames() []string + func (m *Model) ParseTo(writer io.Writer, tpl string) + func (m *Model) Render() string + func (m *Model) SetCreatedAtIfNeed() string + func (m *Model) SetEnabledForFieldValuesAtIfNeed() string + func (m *Model) SetUpdatedAtIfNeed() string + func (m *Model) SetUpdatedForFieldValuesAtIfNeed() string + func (m *Model) TypeTime(fieldName string) string + type SqlFuncGenerator struct + func (g *SqlFuncGenerator) Load(cwd string) + func (g *SqlFuncGenerator) Output(cwd string) codegen.Outputs + func (g *SqlFuncGenerator) Pick() + type TagGenerator struct + StructNames []string + WithDefaults bool + func (g *TagGenerator) Load(cwd string) + func (g *TagGenerator) Output(cwd string) codegen.Outputs + func (g *TagGenerator) Pick() + type Template struct + func T() *Template + func (t *Template) Execute(wr io.Writer, data interface{}) + func (t *Template) Render(data interface{}) string + func (t Template) Funcs(funcMap template.FuncMap) *Template + func (t Template) Parse(tpl string) *Template