package schema
Import Path
gorm.io/gorm/schema (on go.dev)
Dependency Relation
imports 20 packages, and imported by 4 packages
Involved Source Files
check.go
field.go
index.go
interfaces.go
naming.go
relationship.go
schema.go
utils.go
Exported Type Names
type Check (struct)
Constraint string
Field *Field
Field.AutoCreateTime TimeType
Field.AutoIncrement bool
Field.AutoUpdateTime TimeType
Field.BindNames []string
Field.Comment string
Field.Creatable bool
Field.DBName string
Field.DataType DataType
Field.DefaultValue string
Field.DefaultValueInterface interface{}
Field.EmbeddedSchema *Schema
Field.FieldType reflect.Type
Field.GORMDataType DataType
Field.HasDefaultValue bool
Field.IndirectFieldType reflect.Type
Field.NotNull bool
Field.OwnerSchema *Schema
Field.Precision int
Field.PrimaryKey bool
Field.Readable bool
Field.ReflectValueOf func(reflect.Value) reflect.Value
Field.Scale int
Field.Schema *Schema
Field.Set func(reflect.Value, interface{}) error
Field.Size int
Field.StructField reflect.StructField
Field.Tag reflect.StructTag
Field.TagSettings map[string]string
Field.Unique bool
Field.Updatable bool
Field.ValueOf func(reflect.Value) (value interface{}, zero bool)
Name string
func (*Schema).ParseCheckConstraints() map[string]Check
type Constraint (struct)
Field *Field
ForeignKeys []*Field
Name string
OnDelete string
OnUpdate string
ReferenceSchema *Schema
References []*Field
Schema *Schema
func (*Relationship).ParseConstraint() *Constraint
type CreateClausesInterface (interface)
(T) CreateClauses(*Field) []clause.Interface
type DataType string
const Bool
const Bytes
const Float
const Int
const String
const Time
const Uint
type DeleteClausesInterface (interface)
(T) DeleteClauses(*Field) []clause.Interface
gorm.io/gorm.DeletedAt
type Field (struct)
AutoCreateTime TimeType
AutoIncrement bool
AutoUpdateTime TimeType
BindNames []string
Comment string
Creatable bool
DBName string
DataType DataType
DefaultValue string
DefaultValueInterface interface{}
EmbeddedSchema *Schema
FieldType reflect.Type
GORMDataType DataType
HasDefaultValue bool
IndirectFieldType reflect.Type
Name string
NotNull bool
OwnerSchema *Schema
Precision int
PrimaryKey bool
Readable bool
ReflectValueOf func(reflect.Value) reflect.Value
Scale int
Schema *Schema
Set func(reflect.Value, interface{}) error
Size int
StructField reflect.StructField
Tag reflect.StructTag
TagSettings map[string]string
Unique bool
Updatable bool
ValueOf func(reflect.Value) (value interface{}, zero bool)
func Schema.LookUpField(name string) *Field
func (*Schema).ParseField(fieldStruct reflect.StructField) *Field
func GetIdentityFieldValuesMap(reflectValue reflect.Value, fields []*Field) (map[string][]reflect.Value, [][]interface{})
func GetIdentityFieldValuesMapFromValues(values []interface{}, fields []*Field) (map[string][]reflect.Value, [][]interface{})
func CreateClausesInterface.CreateClauses(*Field) []clause.Interface
func DeleteClausesInterface.DeleteClauses(*Field) []clause.Interface
func QueryClausesInterface.QueryClauses(*Field) []clause.Interface
func UpdateClausesInterface.UpdateClauses(*Field) []clause.Interface
func gorm.io/gorm.DeletedAt.DeleteClauses(f *Field) []clause.Interface
func gorm.io/gorm.DeletedAt.QueryClauses(f *Field) []clause.Interface
func gorm.io/gorm.Dialector.DataTypeOf(*Field) string
func gorm.io/gorm.Dialector.DefaultValueOf(*Field) clause.Expression
func gorm.io/gorm.Migrator.FullDataTypeOf(*Field) clause.Expr
func gorm.io/gorm.Migrator.MigrateColumn(dst interface{}, field *Field, columnType gorm.ColumnType) error
func gorm.io/gorm/migrator.GormDataTypeInterface.GormDBDataType(*gorm.DB, *Field) string
func gorm.io/gorm/migrator.Migrator.DataTypeOf(field *Field) string
func gorm.io/gorm/migrator.Migrator.FullDataTypeOf(field *Field) (expr clause.Expr)
func gorm.io/gorm/migrator.Migrator.MigrateColumn(value interface{}, field *Field, columnType gorm.ColumnType) error
func gorm.io/driver/mysql.Dialector.DataTypeOf(field *Field) string
func gorm.io/driver/mysql.Dialector.DefaultValueOf(field *Field) clause.Expression
func gorm.io/driver/mysql.Migrator.FullDataTypeOf(field *Field) clause.Expr
type GormDataTypeInterface (interface)
(T) GormDataType() string
type Index (struct)
Class string
Comment string
Fields []IndexOption
Name string
Option string
Type string
Where string
func (*Schema).LookIndex(name string) *Index
func (*Schema).ParseIndexes() map[string]Index
type IndexOption (struct)
Collate string
Expression string
Field *Field
Field.AutoCreateTime TimeType
Field.AutoIncrement bool
Field.AutoUpdateTime TimeType
Field.BindNames []string
Field.Comment string
Field.Creatable bool
Field.DBName string
Field.DataType DataType
Field.DefaultValue string
Field.DefaultValueInterface interface{}
Field.EmbeddedSchema *Schema
Field.FieldType reflect.Type
Field.GORMDataType DataType
Field.HasDefaultValue bool
Field.IndirectFieldType reflect.Type
Field.Name string
Field.NotNull bool
Field.OwnerSchema *Schema
Field.Precision int
Field.PrimaryKey bool
Field.Readable bool
Field.ReflectValueOf func(reflect.Value) reflect.Value
Field.Scale int
Field.Schema *Schema
Field.Set func(reflect.Value, interface{}) error
Field.Size int
Field.StructField reflect.StructField
Field.Tag reflect.StructTag
Field.TagSettings map[string]string
Field.Unique bool
Field.Updatable bool
Field.ValueOf func(reflect.Value) (value interface{}, zero bool)
Length int
Sort string
func gorm.io/gorm/migrator.BuildIndexOptionsInterface.BuildIndexOptions([]IndexOption, *gorm.Statement) []interface{}
func gorm.io/gorm/migrator.Migrator.BuildIndexOptions(opts []IndexOption, stmt *gorm.Statement) (results []interface{})
type Namer (interface)
Namer namer interface
(T) CheckerName(table, column string) string
(T) ColumnName(table, column string) string
(T) IndexName(table, column string) string
(T) JoinTableName(joinTable string) string
(T) RelationshipFKName(Relationship) string
(T) TableName(table string) string
NamingStrategy
func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
type NamingStrategy (struct)
NamingStrategy tables, columns naming strategy
SingularTable bool
TablePrefix string
(T) CheckerName(table, column string) string
(T) ColumnName(table, column string) string
(T) IndexName(table, column string) string
(T) JoinTableName(str string) string
(T) RelationshipFKName(rel Relationship) string
(T) TableName(str string) string
T : Namer
type Polymorphic (struct)
PolymorphicID *Field
PolymorphicType *Field
Value string
type QueryClausesInterface (interface)
(T) QueryClauses(*Field) []clause.Interface
gorm.io/gorm.DeletedAt
type Reference (struct)
ForeignKey *Field
OwnPrimaryKey bool
PrimaryKey *Field
PrimaryValue string
type Relationship (struct)
Field *Field
FieldSchema *Schema
JoinTable *Schema
Name string
Polymorphic *Polymorphic
References []*Reference
Schema *Schema
Type RelationshipType
(*T) ParseConstraint() *Constraint
(*T) ToQueryConditions(reflectValue reflect.Value) (conds []clause.Expression)
func GetRelationsValues(reflectValue reflect.Value, rels []*Relationship) (reflectResults reflect.Value)
func Namer.RelationshipFKName(Relationship) string
func NamingStrategy.RelationshipFKName(rel Relationship) string
type Relationships (struct)
BelongsTo []*Relationship
HasMany []*Relationship
HasOne []*Relationship
Many2Many []*Relationship
Relations map[string]*Relationship
type RelationshipType string
RelationshipType relationship type
const BelongsTo
const HasMany
const HasOne
const Many2Many
type Schema (struct)
AfterCreate bool
AfterDelete bool
AfterFind bool
AfterSave bool
AfterUpdate bool
BeforeCreate bool
BeforeDelete bool
BeforeSave bool
BeforeUpdate bool
CreateClauses []clause.Interface
DBNames []string
DeleteClauses []clause.Interface
Fields []*Field
FieldsByDBName map[string]*Field
FieldsByName map[string]*Field
FieldsWithDefaultDBValue []*Field
ModelType reflect.Type
Name string
PrimaryFieldDBNames []string
PrimaryFields []*Field
PrioritizedPrimaryField *Field
QueryClauses []clause.Interface
Relationships Relationships
Table string
UpdateClauses []clause.Interface
(*T) LookIndex(name string) *Index
(T) LookUpField(name string) *Field
(T) MakeSlice() reflect.Value
(*T) ParseCheckConstraints() map[string]Check
(*T) ParseField(fieldStruct reflect.StructField) *Field
(*T) ParseIndexes() map[string]Index
(T) String() string
T : fmt.Stringer
func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
type UpdateClausesInterface (interface)
(T) UpdateClauses(*Field) []clause.Interface
Exported Values
const BelongsTo RelationshipType = "belongs_to" // BelongsToRel belongs to relationship
var ErrUnsupportedDataType error
ErrUnsupportedDataType unsupported data type
func GetIdentityFieldValuesMap(reflectValue reflect.Value, fields []*Field) (map[string][]reflect.Value, [][]interface{})
GetIdentityFieldValuesMap get identity map from fields
func GetIdentityFieldValuesMapFromValues(values []interface{}, fields []*Field) (map[string][]reflect.Value, [][]interface{})
GetIdentityFieldValuesMapFromValues get identity map from fields
func GetRelationsValues(reflectValue reflect.Value, rels []*Relationship) (reflectResults reflect.Value)
GetRelationsValues get relations's values from a reflect value
const HasMany RelationshipType = "has_many" // HasManyRel has many relationship
const HasOne RelationshipType = "has_one" // HasOneRel has one relationship
const Many2Many RelationshipType = "many_to_many" // Many2ManyRel many to many relationship
func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
get data type from dialector
func ToQueryValues(table string, foreignKeys []string, foreignValues [][]interface{}) (interface{}, []interface{})
ToQueryValues to query values
const UnixMillisecond TimeType = 2
const UnixNanosecond TimeType = 3
const UnixSecond TimeType = 1
![]() |
The pages are generated with Golds v0.1.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project and developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |