Documentation ¶
Index ¶
- 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
- type Keys
- type 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
- type TagGenerator
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFields ¶
Types ¶
type Config ¶
type Keys ¶
func (*Keys) PatchUniqueIndexesWithSoftDelete ¶
type Model ¶
type Model struct { *types.TypeName *codegen.Importer *Config *Template *Keys *builder.Table Fields map[string]*types.Var FieldAutoIncrement string HasSoftDelete bool HasCreatedAt bool HasUpdatedAt bool HasAutoIncrement bool }
func (*Model) EnableIfNeed ¶
func (*Model) GetComments ¶
func (*Model) IndexFieldNames ¶
func (*Model) SetCreatedAtIfNeed ¶
func (*Model) SetEnabledForFieldValuesAtIfNeed ¶
func (*Model) SetUpdatedAtIfNeed ¶
func (*Model) SetUpdatedForFieldValuesAtIfNeed ¶
type SqlFuncGenerator ¶
type SqlFuncGenerator struct { Config // contains filtered or unexported fields }
func (*SqlFuncGenerator) Load ¶
func (g *SqlFuncGenerator) Load(cwd string)
func (*SqlFuncGenerator) Pick ¶
func (g *SqlFuncGenerator) Pick()
type TagGenerator ¶
type TagGenerator struct { StructNames []string WithDefaults bool // contains filtered or unexported fields }
func (*TagGenerator) Load ¶
func (g *TagGenerator) Load(cwd string)
func (*TagGenerator) Pick ¶
func (g *TagGenerator) Pick()
Source Files ¶
Click to show internal directories.
Click to hide internal directories.