Documentation ¶
Index ¶
- type Column
- func (c *Column) AddDataTypeMap(key, value string)
- func (c *Column) AddDataTypePkgMap(key, value string)
- func (c *Column) GetDataType() (fieldtype string)
- func (c *Column) SetDataTypeMap(m map[string]string)
- func (c *Column) SetDataTypePkgMap(m map[string]string)
- func (c *Column) ToField(nullable, coverable, signable bool) (string, *Field)
- func (c *Column) WithNS(jsonTagNS func(columnName string) string)
- type Config
- type Field
- type FieldConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { gorm.ColumnType TableName string `gorm:"column:TABLE_NAME"` UseScanType bool `gorm:"-"` // contains filtered or unexported fields }
Column table column's info
func (*Column) AddDataTypeMap ¶ added in v1.0.0
func (*Column) AddDataTypePkgMap ¶ added in v1.0.0
func (*Column) GetDataType ¶
GetDataType get data type
func (*Column) SetDataTypeMap ¶
SetDataTypeMap set data type map
func (*Column) SetDataTypePkgMap ¶ added in v1.0.0
SetDataTypePkgMap set data type pkg map
type Config ¶
type Config struct { ModelPkg string TableName string ModelName string //ImportPkgPaths []string TemplateDir string FieldWithTags []string ConvTypeMap map[string]string ConvTypePkgMap map[string]string DynamicConstSuffixes []string // dynamic const suffix AutoValueFields []string FieldConfig }
Config model configuration
type Field ¶
type Field struct { Name string ColumnName string TypeName string OriginalTypeName string // 原始类型 DatabaseTypeName string // varchar ColumnType string // varchar(64) PrimaryKey bool AutoIncrement bool Length int64 DecimalSizeOK bool DecimalSizeScale int64 DecimalSizePrecision int64 Nullable bool Unique bool ScanType reflect.Type Comment string DefaultValueOK bool DefaultValue string CustomTypeMap map[string]string // 自定义类型映射 }
type FieldConfig ¶
type FieldConfig struct { DataTypeMap map[string]string DataTypePkgMap map[string]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 FieldJSONTagNS func(columnName string) string }
FieldConfig field configuration
Click to show internal directories.
Click to hide internal directories.