forked from mirror/gorm
update
This commit is contained in:
parent
5d692a6bf2
commit
1726cebc2e
1
field.go
1
field.go
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
type Field struct {
|
||||
*StructField
|
||||
IsBlank bool
|
||||
Field reflect.Value
|
||||
}
|
||||
|
||||
|
|
|
@ -8,10 +8,15 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
type ModelStruct struct {
|
||||
PrimaryKeyField *StructField
|
||||
StructFields []*StructField
|
||||
TableName string
|
||||
}
|
||||
|
||||
type StructField struct {
|
||||
Name string
|
||||
DBName string
|
||||
IsBlank bool
|
||||
IsPrimaryKey bool
|
||||
IsScanner bool
|
||||
IsTime bool
|
||||
|
@ -19,7 +24,17 @@ type StructField struct {
|
|||
IsIgnored bool
|
||||
DefaultValue *string
|
||||
SqlTag string
|
||||
Relationship *relationship
|
||||
Relationship *Relationship
|
||||
}
|
||||
|
||||
type Relationship struct {
|
||||
Kind string
|
||||
ForeignType string
|
||||
ForeignFieldName string
|
||||
ForeignDBName string
|
||||
AssociationForeignFieldName string
|
||||
AssociationForeignDBName string
|
||||
JoinTable string
|
||||
}
|
||||
|
||||
func (scope *Scope) GetStructFields() (fields []*StructField) {
|
||||
|
@ -192,11 +207,9 @@ func (scope *Scope) GetStructFields() (fields []*StructField) {
|
|||
}
|
||||
if field.IsNormal {
|
||||
typ + " " + additionalType
|
||||
}
|
||||
} else if !field.IsTime {
|
||||
return typ + " " + additionalType
|
||||
}
|
||||
}
|
||||
|
||||
if len(typ) == 0 {
|
||||
if field.IsPrimaryKey {
|
Loading…
Reference in New Issue