From b5c26997dfe9e4e68485de506080e2444af0fc43 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 22 Jul 2021 11:29:16 +0800 Subject: [PATCH] Add fieldtype for column --- tags/parser.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tags/parser.go b/tags/parser.go index efee11e7..03aa5f63 100644 --- a/tags/parser.go +++ b/tags/parser.go @@ -167,6 +167,7 @@ func (parser *Parser) parseFieldWithNoTag(fieldIndex int, field reflect.StructFi field.Name, sqlType, sqlType.DefaultLength, sqlType.DefaultLength2, true) 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")) { col.IsAutoIncrement = true @@ -186,6 +187,7 @@ func (parser *Parser) parseFieldWithTags(table *schemas.Table, fieldIndex int, f MapType: schemas.TWOSIDES, Indexes: make(map[string]int), DefaultIsEmpty: true, + FieldType: fieldValue.Type(), } var ctx = Context{