Add fieldtype for column
This commit is contained in:
parent
68f18c80e2
commit
b5c26997df
|
@ -167,6 +167,7 @@ func (parser *Parser) parseFieldWithNoTag(fieldIndex int, field reflect.StructFi
|
||||||
field.Name, sqlType, sqlType.DefaultLength,
|
field.Name, sqlType, sqlType.DefaultLength,
|
||||||
sqlType.DefaultLength2, true)
|
sqlType.DefaultLength2, true)
|
||||||
col.FieldIndex = []int{fieldIndex}
|
col.FieldIndex = []int{fieldIndex}
|
||||||
|
col.FieldType = fieldValue.Type()
|
||||||
|
|
||||||
if field.Type.Kind() == reflect.Int64 && (strings.ToUpper(col.FieldName) == "ID" || strings.HasSuffix(strings.ToUpper(col.FieldName), ".ID")) {
|
if field.Type.Kind() == reflect.Int64 && (strings.ToUpper(col.FieldName) == "ID" || strings.HasSuffix(strings.ToUpper(col.FieldName), ".ID")) {
|
||||||
col.IsAutoIncrement = true
|
col.IsAutoIncrement = true
|
||||||
|
@ -186,6 +187,7 @@ func (parser *Parser) parseFieldWithTags(table *schemas.Table, fieldIndex int, f
|
||||||
MapType: schemas.TWOSIDES,
|
MapType: schemas.TWOSIDES,
|
||||||
Indexes: make(map[string]int),
|
Indexes: make(map[string]int),
|
||||||
DefaultIsEmpty: true,
|
DefaultIsEmpty: true,
|
||||||
|
FieldType: fieldValue.Type(),
|
||||||
}
|
}
|
||||||
|
|
||||||
var ctx = Context{
|
var ctx = Context{
|
||||||
|
|
Loading…
Reference in New Issue