Documentation ¶
Index ¶
- func CheckFields(table *builder.Table, fieldNames ...string) (cols builder.Columns, err error)
- func WithDefaults(dataType string, withDefaults bool, defaultValue string) string
- type Config
- type DataTypeDescriber
- type Keys
- type Model
- func (m *Model) FieldType(file *codegen.File, fieldName string) codegen.SnippetType
- func (m *Model) GetComments() map[string]string
- func (m *Model) IndexFieldNames() []string
- func (m *Model) PtrType() codegen.SnippetType
- func (m *Model) SnippetDisableIfNeedForFieldValues(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetEnableIfNeed(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetEnableIfNeedForFieldValues(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetSetCreatedAtIfNeed(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetSetLastInsertIdIfNeed(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetSetUpdatedAtIfNeed(file *codegen.File) codegen.Snippet
- func (m *Model) SnippetSetUpdatedAtIfNeedForFieldValues(file *codegen.File) codegen.Snippet
- func (m *Model) Type() codegen.SnippetType
- func (m *Model) VarTable() string
- func (m *Model) WriteBatchList(file *codegen.File)
- func (m *Model) WriteByKey(file *codegen.File)
- func (m *Model) WriteCRUD(file *codegen.File)
- func (m *Model) WriteCount(file *codegen.File)
- func (m *Model) WriteCreate(file *codegen.File)
- func (m *Model) WriteDelete(file *codegen.File)
- func (m *Model) WriteList(file *codegen.File)
- func (m *Model) WriteTableInterfaces(file *codegen.File)
- func (m *Model) WriteTableKeyInterfaces(file *codegen.File)
- func (m *Model) WriteTo(file *codegen.File)
- type SqlFuncGenerator
- type TagGenerator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFields ¶
Types ¶
type Config ¶
type Config struct { StructName string TableName string Database string WithComments bool WithTableInterfaces bool FieldPrimaryKey string FieldKeySoftDelete string FieldKeyCreatedAt string FieldKeyUpdatedAt string ConstSoftDeleteTrue string ConstSoftDeleteFalse string }
func (*Config) SetDefaults ¶
func (g *Config) SetDefaults()
type DataTypeDescriber ¶ added in v1.1.1
type DataTypeDescriber interface {
DateType() string
}
type Keys ¶
type Keys struct { Primary builder.FieldNames Indexes builder.Indexes UniqueIndexes builder.Indexes SpatialIndexes builder.Indexes }
func (*Keys) PatchUniqueIndexesWithSoftDelete ¶
type Model ¶
type Model struct { *types.TypeName *Config *Keys *builder.Table Fields map[string]*types.Var FieldKeyAutoIncrement string HasSoftDelete bool HasCreatedAt bool HasUpdatedAt bool HasAutoIncrement bool }
func (*Model) GetComments ¶
func (*Model) IndexFieldNames ¶
func (*Model) PtrType ¶
func (m *Model) PtrType() codegen.SnippetType
func (*Model) SnippetDisableIfNeedForFieldValues ¶
func (*Model) SnippetEnableIfNeed ¶
func (*Model) SnippetEnableIfNeedForFieldValues ¶
func (*Model) SnippetSetCreatedAtIfNeed ¶
func (*Model) SnippetSetLastInsertIdIfNeed ¶
func (*Model) SnippetSetUpdatedAtIfNeed ¶
func (*Model) SnippetSetUpdatedAtIfNeedForFieldValues ¶
func (*Model) Type ¶
func (m *Model) Type() codegen.SnippetType
func (*Model) WriteBatchList ¶
func (*Model) WriteByKey ¶
func (*Model) WriteCount ¶
func (*Model) WriteCreate ¶
func (*Model) WriteDelete ¶
func (*Model) WriteTableInterfaces ¶
func (*Model) WriteTableKeyInterfaces ¶
type SqlFuncGenerator ¶
type SqlFuncGenerator struct { Config // contains filtered or unexported fields }
func NewSqlFuncGenerator ¶
func NewSqlFuncGenerator(pkg *packagesx.Package) *SqlFuncGenerator
func (*SqlFuncGenerator) Output ¶
func (g *SqlFuncGenerator) Output(cwd string)
func (*SqlFuncGenerator) Scan ¶
func (g *SqlFuncGenerator) Scan()
type TagGenerator ¶
type TagGenerator struct { WithDefaults bool // contains filtered or unexported fields }
func NewTagGenerator ¶
func NewTagGenerator(pkg *packagesx.Package) *TagGenerator
func (*TagGenerator) Output ¶
func (g *TagGenerator) Output(cwd string)
func (*TagGenerator) Scan ¶
func (g *TagGenerator) Scan(structNames ...string)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.