rename variable
This commit is contained in:
parent
08e9ba73a8
commit
4499a24822
@ -56,7 +56,7 @@ type Field struct {
|
|||||||
BindNames []string
|
BindNames []string
|
||||||
DataType DataType
|
DataType DataType
|
||||||
GORMDataType DataType
|
GORMDataType DataType
|
||||||
CustomDataType DataType
|
IsTaggedType bool
|
||||||
PrimaryKey bool
|
PrimaryKey bool
|
||||||
AutoIncrement bool
|
AutoIncrement bool
|
||||||
AutoIncrementIncrement int64
|
AutoIncrementIncrement int64
|
||||||
@ -311,7 +311,7 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field {
|
|||||||
default:
|
default:
|
||||||
field.DataType = DataType(val)
|
field.DataType = DataType(val)
|
||||||
}
|
}
|
||||||
field.CustomDataType = DataType(val)
|
field.IsTaggedType = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if field.Size == 0 {
|
if field.Size == 0 {
|
||||||
|
@ -23,9 +23,9 @@ func TestParseCustomTypeSchema(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fields := []schema.Field{
|
fields := []schema.Field{
|
||||||
{Name: "Date", DBName: "date", BindNames: []string{"Date"}, DataType: "date", CustomDataType: "date", Tag: `gorm:"type:date"`, TagSettings: map[string]string{"TYPE": "date"}},
|
{Name: "Date", DBName: "date", BindNames: []string{"Date"}, DataType: "date", IsTaggedType: true, Tag: `gorm:"type:date"`, TagSettings: map[string]string{"TYPE": "date"}},
|
||||||
{Name: "Time", DBName: "time", BindNames: []string{"Time"}, DataType: schema.Time, CustomDataType: "time", Tag: `gorm:"type:time"`, TagSettings: map[string]string{"TYPE": "time"}},
|
{Name: "Time", DBName: "time", BindNames: []string{"Time"}, DataType: schema.Time, IsTaggedType: true, Tag: `gorm:"type:time"`, TagSettings: map[string]string{"TYPE": "time"}},
|
||||||
{Name: "DateTime", DBName: "date_time", BindNames: []string{"DateTime"}, DataType: schema.Time},
|
{Name: "DateTime", DBName: "date_time", BindNames: []string{"DateTime"}, DataType: schema.Time, IsTaggedType: false},
|
||||||
}
|
}
|
||||||
for i := range fields {
|
for i := range fields {
|
||||||
checkSchemaField(t, product, &fields[i], func(field *schema.Field) {
|
checkSchemaField(t, product, &fields[i], func(field *schema.Field) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user