Documentation ¶
Index ¶
- Constants
- Variables
- func GroupByColumn(indexList []gorm.Index) map[string][]*Index
- type AddMethodOpt
- type Column
- type Config
- type CreateFieldOpt
- type Field
- type FieldConfig
- type FieldOption
- type FilterFieldOpt
- type Index
- type KeyWord
- type MethodConfig
- type MethodOption
- type ModifyFieldOpt
- type NameStrategy
- type Option
- type SQLBuffer
- type SchemaNameOpt
- type SourceCode
- type Status
Constants ¶
const ( // DefaultModelPkg ... DefaultModelPkg = "model" // DefaultDtoPkg ... DefaultDtoPkg = "dto" )
Variables ¶
var DOKeywords = KeyWord{ // contains filtered or unexported fields }
DOKeywords ...
var GenKeywords = KeyWord{ // contains filtered or unexported fields }
GenKeywords ...
var GormKeywords = KeyWord{ // contains filtered or unexported fields }
GormKeywords ...
Functions ¶
Types ¶
type AddMethodOpt ¶
type AddMethodOpt func() (methods []interface{})
AddMethodOpt diy method option
func (AddMethodOpt) OptionType ¶
func (AddMethodOpt) OptionType() string
OptionType implement for interface Option
type Column ¶
type Column struct { gorm.ColumnType TableName string `gorm:"column:TABLE_NAME"` Indexes []*Index `gorm:"-"` UseScanType bool `gorm:"-"` // contains filtered or unexported fields }
Column table column's info
func (*Column) GetDataType ¶
GetDataType get data type
func (*Column) SetDataTypeMap ¶
func (c *Column) SetDataTypeMap(m map[string]func(columnType gorm.ColumnType) (dataType string))
SetDataTypeMap set data type map
type Config ¶
type Config struct { ModelPkg string TablePrefix string TableName string ModelName string ImportPkgPaths []string ModelOpts []Option NameStrategy FieldConfig MethodConfig }
Config model configuration
func (*Config) GetModelMethods ¶
func (cfg *Config) GetModelMethods() (methods []interface{})
GetModelMethods get diy method from option
func (*Config) GetSchemaName ¶
GetSchemaName get schema name
type CreateFieldOpt ¶
type CreateFieldOpt ModifyFieldOpt
CreateFieldOpt create field option
func (CreateFieldOpt) Operator ¶
func (o CreateFieldOpt) Operator() func(*Field) *Field
Operator implement for FieldOpt
func (CreateFieldOpt) OptionType ¶
func (CreateFieldOpt) OptionType() string
OptionType implement for interface Option
type Field ¶
type Field struct { Name string Type string ColumnName string ColumnComment string MultilineComment bool Tag field.Tag GORMTag field.GormTag CustomGenType string Relation *field.Relation PriKey bool }
Field user input structures
func (*Field) EscapeKeywordFor ¶
EscapeKeywordFor escape for specified keyword
type FieldConfig ¶
type FieldConfig struct { DataTypeMap map[string]func(columnType gorm.ColumnType) (dataType string) FieldNullable bool // generate pointer when field is nullable FieldCoverable bool // generate pointer when field has default value FieldSignable bool // detect integer field's unsigned type, adjust generated data type FieldWithIndexTag bool // generate with gorm index tag FieldWithTypeTag bool // generate with gorm column type tag FieldJSONTagNS func(columnName string) string ModifyOpts []FieldOption FilterOpts []FieldOption CreateOpts []FieldOption }
FieldConfig field configuration
type FieldOption ¶
FieldOption ...
type FilterFieldOpt ¶
type FilterFieldOpt ModifyFieldOpt
FilterFieldOpt filter field option
func (FilterFieldOpt) Operator ¶
func (o FilterFieldOpt) Operator() func(*Field) *Field
Operator implement for FieldOpt
func (FilterFieldOpt) OptionType ¶
func (FilterFieldOpt) OptionType() string
OptionType implement for interface Option
type MethodConfig ¶
type MethodConfig struct {
MethodOpts []MethodOption
}
MethodConfig method configuration
type MethodOption ¶
type MethodOption interface { Option Methods() (methods []interface{}) }
MethodOption ...
type ModifyFieldOpt ¶
ModifyFieldOpt modify field option
func (ModifyFieldOpt) Operator ¶
func (o ModifyFieldOpt) Operator() func(*Field) *Field
Operator implement for FieldOpt
func (ModifyFieldOpt) OptionType ¶
func (ModifyFieldOpt) OptionType() string
OptionType implement for interface Option
type NameStrategy ¶
type NameStrategy struct { SchemaNameOpts []SchemaNameOpt TableNameNS func(tableName string) string ModelNameNS func(tableName string) string FileNameNS func(tableName string) string }
NameStrategy name strategy
type SourceCode ¶
type SourceCode int
SourceCode source code
const ( // Struct ... Struct SourceCode = iota // Table ... Table // Object ... Object )