Documentation ¶
Index ¶
- Variables
- func ParseTagSetting(str string, sep string) map[string]string
- type BeforeCreate
- type DataType
- type Field
- type GormDataTypeInterface
- type Index
- type IndexOption
- type Namer
- type NamingStrategy
- type Options
- type Replacer
- type Schema
- func (schema Schema) FieldDBName(name string) string
- func (schema *Schema) LookIndex(name string) *Index
- func (schema Schema) LookUpField(name string) *Field
- func (schema Schema) MakeSlice() reflect.Value
- func (schema Schema) New() reflect.Value
- func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field
- func (schema *Schema) ParseIndexes() map[string]Index
- func (schema Schema) String() string
- type Tabler
- type TimeType
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedDataType = errors.New("unsupported data type")
ErrUnsupportedDataType unsupported data type
View Source
var TimeReflectType = reflect.TypeOf(time.Time{})
Functions ¶
Types ¶
type BeforeCreate ¶ added in v1.0.0
type Field ¶
type Field struct { Name string DBName string BindNames []string DataType DataType GORMDataType DataType PrimaryKey bool AutoIncrement bool AutoIncrementIncrement int64 Creatable bool Updatable bool Readable bool HasDefaultValue bool AutoCreateTime TimeType AutoUpdateTime TimeType DefaultValue string DefaultValueInterface interface{} NotNull bool Unique bool Comment string Size int Precision int Scale int FieldType reflect.Type IndirectFieldType reflect.Type StructField reflect.StructField Tag reflect.StructTag TagSettings map[string]string Schema *Schema EmbeddedSchema *Schema OwnerSchema *Schema ReflectValueOf func(reflect.Value) reflect.Value ValueOf func(reflect.Value) (value interface{}, zero bool) Set func(reflect.Value, interface{}) error IgnoreMigration bool }
type GormDataTypeInterface ¶
type GormDataTypeInterface interface {
GormDataType() string
}
type Index ¶
type Index struct { Name string Unique bool //唯一 Sparse bool //稀疏索引 Fields []IndexOption }
type IndexOption ¶ added in v1.0.0
type NamingStrategy ¶
type NamingStrategy struct { TablePrefix string SingularTable bool NameReplacer Replacer NoLowerCase bool }
NamingStrategy tables, columns naming strategy
func (NamingStrategy) ColumnName ¶
func (ns NamingStrategy) ColumnName(table, column string) string
ColumnName convert string to column name
func (NamingStrategy) TableName ¶
func (ns NamingStrategy) TableName(str string) string
TableName convert string to table name
type Schema ¶
type Schema struct { Name string Table string Fields []*Field ModelType reflect.Type FieldsByName map[string]*Field FieldsByDBName map[string]*Field // contains filtered or unexported fields }
func (Schema) FieldDBName ¶
FieldDBName 查询对象字段对应的DBName
func (Schema) LookUpField ¶
func (*Schema) ParseField ¶
func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field
func (*Schema) ParseIndexes ¶
ParseIndexes parse schema indexes
Click to show internal directories.
Click to hide internal directories.