Documentation
¶
Index ¶
- Variables
- func ParseTagSetting(str string, sep string) map[string]string
- type Field
- type GormDataTypeInterface
- type Index
- type IndexField
- type Namer
- type NamingStrategy
- type Options
- type Replacer
- type Schema
- func (schema Schema) FieldDBName(name string) string
- func (schema Schema) GetValue(i interface{}, key string) interface{}
- 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
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUnsupportedDataType = errors.New("unsupported data type")
ErrUnsupportedDataType unsupported data type
Functions ¶
Types ¶
type Field ¶
type Field struct {
Name string
DBName string
FieldType reflect.Type
IndirectFieldType reflect.Type
StructField reflect.StructField
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
}
type GormDataTypeInterface ¶
type GormDataTypeInterface interface {
GormDataType() string
}
type Index ¶
type Index struct {
Name string
Unique bool //唯一
Sparse bool //稀疏索引
Fields []*IndexField
}
func (*Index) Build ¶
func (this *Index) Build() (index mongo.IndexModel)
type IndexField ¶
type IndexField struct {
//*Field
Sort string // DESC, ASC
Name string // index name
DBName []string // a.b.c
Unique bool //唯一
Sparse bool //稀疏索引
Priority int //排序字段之间的排序
}
func (*IndexField) GetDBName ¶
func (this *IndexField) GetDBName() string
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 ParseWithSpecialTableName ¶
func ParseWithSpecialTableName(dest interface{}, specialTableName string, opts *Options) (*Schema, error)
ParseWithSpecialTableName get data type from dialector with extra schema table
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.