package schema
Import Path
gorm.io/gorm/schema (on go.dev)
Dependency Relation
imports 24 packages, and imported by 5 packages
Involved Source Files
check.go
field.go
index.go
interfaces.go
naming.go
pool.go
relationship.go
schema.go
serializer.go
utils.go
Package-Level Type Names (total 29)
// length(phone) >= 10
Field *Field
Field.AutoCreateTime TimeType
Field.AutoIncrement bool
Field.AutoIncrementIncrement int64
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.IgnoreMigration bool
Field.IndirectFieldType reflect.Type
Field.NewValuePool FieldNewValuePool
Field.NotNull bool
Field.OwnerSchema *Schema
Field.Precision int
Field.PrimaryKey bool
Field.Readable bool
Field.ReflectValueOf func(context.Context, reflect.Value) reflect.Value
Field.Scale int
Field.Schema *Schema
Field.Serializer SerializerInterface
Field.Set func(context.Context, 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(context.Context, reflect.Value) (value interface{}, zero bool)
Name string
( Check) BindName() string
func (*Schema).ParseCheckConstraints() map[string]Check
func gorm.io/gorm/migrator.Migrator.GuessConstraintAndTable(stmt *gorm.Statement, name string) (_ *Constraint, _ *Check, table string)
Field *Field
ForeignKeys []*Field
Name string
OnDelete string
OnUpdate string
ReferenceSchema *Schema
References []*Field
Schema *Schema
func (*Relationship).ParseConstraint() *Constraint
func gorm.io/gorm/migrator.Migrator.GuessConstraintAndTable(stmt *gorm.Statement, name string) (_ *Constraint, _ *Check, table string)
CreateClausesInterface create clauses interface
( CreateClausesInterface) CreateClauses(*Field) []clause.Interface
DataType GORM data type
const Bool
const Bytes
const Float
const Int
const String
const Time
const Uint
DeleteClausesInterface delete clauses interface
( DeleteClausesInterface) DeleteClauses(*Field) []clause.Interface
gorm.io/gorm.DeletedAt
Field is the representation of model schema's field
AutoCreateTime TimeType
AutoIncrement bool
AutoIncrementIncrement int64
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
IgnoreMigration bool
IndirectFieldType reflect.Type
Name string
NewValuePool FieldNewValuePool
NotNull bool
OwnerSchema *Schema
Precision int
PrimaryKey bool
Readable bool
ReflectValueOf func(context.Context, reflect.Value) reflect.Value
Scale int
Schema *Schema
Serializer SerializerInterface
Set func(context.Context, reflect.Value, interface{}) error
Size int
StructField reflect.StructField
Tag reflect.StructTag
TagSettings map[string]string
Unique bool
Updatable bool
ValueOf func(context.Context, reflect.Value) (value interface{}, zero bool)
(*Field) BindName() string
func Schema.LookUpField(name string) *Field
func Schema.LookUpFieldByBindName(bindNames []string, name string) *Field
func (*Schema).ParseField(fieldStruct reflect.StructField) *Field
func GetIdentityFieldValuesMap(ctx context.Context, reflectValue reflect.Value, fields []*Field) (map[string][]reflect.Value, [][]interface{})
func GetIdentityFieldValuesMapFromValues(ctx context.Context, values []interface{}, fields []*Field) (map[string][]reflect.Value, [][]interface{})
func CreateClausesInterface.CreateClauses(*Field) []clause.Interface
func DeleteClausesInterface.DeleteClauses(*Field) []clause.Interface
func GobSerializer.Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) (err error)
func GobSerializer.Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
func JSONSerializer.Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) (err error)
func JSONSerializer.Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
func QueryClausesInterface.QueryClauses(*Field) []clause.Interface
func SerializerInterface.Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) error
func SerializerInterface.Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
func SerializerValuerInterface.Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
func UnixSecondSerializer.Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) (err error)
func UnixSecondSerializer.Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (result interface{}, err error)
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.DeletedAt.UpdateClauses(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
func gorm.io/driver/postgres.Dialector.DataTypeOf(field *Field) string
func gorm.io/driver/postgres.Dialector.DefaultValueOf(field *Field) clause.Expression
func gorm.io/driver/postgres.Migrator.CreateSequence(tx *gorm.DB, stmt *gorm.Statement, field *Field, serialDatabaseType string) (err error)
func gorm.io/driver/postgres.Migrator.DeleteSequence(tx *gorm.DB, stmt *gorm.Statement, field *Field, fileType clause.Expr) (err error)
func gorm.io/driver/postgres.Migrator.MigrateColumn(value interface{}, field *Field, columnType gorm.ColumnType) error
func gorm.io/driver/postgres.Migrator.UpdateSequence(tx *gorm.DB, stmt *gorm.Statement, field *Field, serialDatabaseType string) (err error)
FieldNewValuePool field new scan value pool
( FieldNewValuePool) Get() interface{}
( FieldNewValuePool) Put(interface{})
*sync.Pool
GobSerializer gob serializer
Scan implements serializer interface
Value implements serializer interface
GobSerializer : SerializerInterface
GobSerializer : SerializerValuerInterface
GormDataTypeInterface gorm data type interface
( GormDataTypeInterface) GormDataType() string
// UNIQUE | FULLTEXT | SPATIAL
Comment string
Fields []IndexOption
Name string
// WITH PARSER parser_name
// btree, hash, gist, spgist, gin, and brin
Where string
func (*Schema).LookIndex(name string) *Index
func (*Schema).ParseIndexes() map[string]Index
Collate string
Expression string
Field *Field
Field.AutoCreateTime TimeType
Field.AutoIncrement bool
Field.AutoIncrementIncrement int64
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.IgnoreMigration bool
Field.IndirectFieldType reflect.Type
Field.Name string
Field.NewValuePool FieldNewValuePool
Field.NotNull bool
Field.OwnerSchema *Schema
Field.Precision int
Field.PrimaryKey bool
Field.Readable bool
Field.ReflectValueOf func(context.Context, reflect.Value) reflect.Value
Field.Scale int
Field.Schema *Schema
Field.Serializer SerializerInterface
Field.Set func(context.Context, 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(context.Context, reflect.Value) (value interface{}, zero bool)
Length int
// DESC, ASC
( IndexOption) BindName() 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{})
func gorm.io/driver/postgres.Migrator.BuildIndexOptions(opts []IndexOption, stmt *gorm.Statement) (results []interface{})
JSONSerializer json serializer
Scan implements serializer interface
Value implements serializer interface
JSONSerializer : SerializerInterface
JSONSerializer : SerializerValuerInterface
Namer namer interface
( Namer) CheckerName(table, column string) string
( Namer) ColumnName(table, column string) string
( Namer) IndexName(table, column string) string
( Namer) JoinTableName(joinTable string) string
( Namer) RelationshipFKName(Relationship) string
( Namer) SchemaName(table string) string
( Namer) TableName(table string) string
NamingStrategy
func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Namer, specialTableName string) (*Schema, error)
func TablerWithNamer.TableName(Namer) string
NamingStrategy tables, columns naming strategy
IdentifierMaxLength int
NameReplacer Replacer
NoLowerCase bool
SingularTable bool
TablePrefix string
CheckerName generate checker name
ColumnName convert string to column name
IndexName generate index name
JoinTableName convert string to join table name
RelationshipFKName generate fk name for relation
SchemaName generate schema name from table name, don't guarantee it is the reverse value of TableName
TableName convert string to table name
NamingStrategy : Namer
QueryClausesInterface query clauses interface
( QueryClausesInterface) QueryClauses(*Field) []clause.Interface
gorm.io/gorm.DeletedAt
Field *Field
FieldSchema *Schema
JoinTable *Schema
Name string
Polymorphic *Polymorphic
References []*Reference
Schema *Schema
Type RelationshipType
(*Relationship) ParseConstraint() *Constraint
(*Relationship) ToQueryConditions(ctx context.Context, reflectValue reflect.Value) (conds []clause.Expression)
func GetRelationsValues(ctx context.Context, reflectValue reflect.Value, rels []*Relationship) (reflectResults reflect.Value)
func Namer.RelationshipFKName(Relationship) string
func NamingStrategy.RelationshipFKName(rel Relationship) string
BelongsTo []*Relationship
EmbeddedRelations map[string]*Relationships
HasMany []*Relationship
HasOne []*Relationship
Many2Many []*Relationship
Relations map[string]*Relationship
Replacer replacer interface like strings.Replacer
( Replacer) Replace(name string) string
*strings.Replacer
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
// embedded fields is 'Embed.Field'
FieldsByDBName map[string]*Field
FieldsByName map[string]*Field
// fields with default value assigned by database
ModelType reflect.Type
Name string
PrimaryFieldDBNames []string
PrimaryFields []*Field
PrioritizedPrimaryField *Field
QueryClauses []clause.Interface
Relationships Relationships
Table string
UpdateClauses []clause.Interface
(*Schema) LookIndex(name string) *Index
( Schema) LookUpField(name string) *Field
LookUpFieldByBindName looks for the closest field in the embedded struct.
type Struct struct {
Embedded struct {
ID string // is selected by LookUpFieldByBindName([]string{"Embedded", "ID"}, "ID")
}
ID string // is selected by LookUpFieldByBindName([]string{"ID"}, "ID")
}
( Schema) MakeSlice() reflect.Value
ParseCheckConstraints parse schema check constraints
ParseField parses reflect.StructField to Field
ParseIndexes parse schema indexes
( Schema) String() string
Schema : fmt.Stringer
Schema : github.com/ChrisTrenkamp/goxpath/tree.Result
func Parse(dest interface{}, cacheStore *sync.Map, namer Namer) (*Schema, error)
func ParseWithSpecialTableName(dest interface{}, cacheStore *sync.Map, namer Namer, specialTableName string) (*Schema, error)
SerializerInterface serializer interface
( SerializerInterface) Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) error
( SerializerInterface) Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
GobSerializer
JSONSerializer
UnixSecondSerializer
SerializerInterface : SerializerValuerInterface
func GetSerializer(name string) (serializer SerializerInterface, ok bool)
func RegisterSerializer(name string, serializer SerializerInterface)
SerializerValuerInterface serializer valuer interface
( SerializerValuerInterface) Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (interface{}, error)
GobSerializer
JSONSerializer
SerializerInterface (interface)
UnixSecondSerializer
( Tabler) TableName() string
github.com/limanmys/render-engine/app/models.AccessToken
github.com/limanmys/render-engine/app/models.CronJob
github.com/limanmys/render-engine/app/models.Extension
github.com/limanmys/render-engine/app/models.Licence
github.com/limanmys/render-engine/app/models.Oauth2Token
github.com/limanmys/render-engine/app/models.Permission
github.com/limanmys/render-engine/app/models.Queue
github.com/limanmys/render-engine/app/models.RoleUsers
github.com/limanmys/render-engine/app/models.Server
github.com/limanmys/render-engine/app/models.ServerKey
github.com/limanmys/render-engine/app/models.Settings
github.com/limanmys/render-engine/app/models.Token
github.com/limanmys/render-engine/app/models.User
TimeType GORM time type
const UnixMillisecond
const UnixNanosecond
const UnixSecond
const UnixTime
UnixSecondSerializer json serializer
Scan implements serializer interface
Value implements serializer interface
UnixSecondSerializer : SerializerInterface
UnixSecondSerializer : SerializerValuerInterface
UpdateClausesInterface update clauses interface
( UpdateClausesInterface) UpdateClauses(*Field) []clause.Interface
gorm.io/gorm.DeletedAt
Package-Level Functions (total 9)
GetIdentityFieldValuesMap get identity map from fields
GetIdentityFieldValuesMapFromValues get identity map from fields
GetRelationsValues get relations's values from a reflect value
GetSerializer get serializer
Parse get data type from dialector
func ParseTagSetting(str string, sep string) map[string]string
ParseWithSpecialTableName get data type from dialector with extra schema table
RegisterSerializer register serializer
ToQueryValues to query values
Package-Level Variables (total 4)
special types' reflect type
ErrUnsupportedDataType unsupported data type
special types' reflect type
special types' reflect type
Package-Level Constants (total 15)
const BelongsTo RelationshipType = "belongs_to" // BelongsToRel belongs to relationship
GORM fields types
GORM fields types
GORM fields types
const HasMany RelationshipType = "has_many" // HasManyRel has many relationship const HasOne RelationshipType = "has_one" // HasOneRel has one relationship
GORM fields types
const Many2Many RelationshipType = "many_to_many" // Many2ManyRel many to many relationship
GORM fields types
GORM fields types
GORM fields types
GORM time types
GORM time types
GORM time types
GORM time types
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project 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. |