From 1e6e78565155a7fd1f1b43c1a11b7a9f06055cd1 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 5 Jan 2015 08:43:01 +0800 Subject: [PATCH] Fix return incorrect sql type --- scope_private.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scope_private.go b/scope_private.go index a109b5ae..4d93e7ba 100644 --- a/scope_private.go +++ b/scope_private.go @@ -396,7 +396,7 @@ func (scope *Scope) sqlTagForField(field *Field) (typ string) { switch reflectValue.Kind() { case reflect.Slice: if _, ok := value.([]byte); !ok { - return + return typ + " " + additionalType } case reflect.Struct: if field.IsScanner() { @@ -409,7 +409,7 @@ func (scope *Scope) sqlTagForField(field *Field) (typ string) { } getScannerValue(reflectValue.Field(0)) } else if !field.IsTime() { - return + return typ + " " + additionalType } } @@ -421,10 +421,7 @@ func (scope *Scope) sqlTagForField(field *Field) (typ string) { } } - if len(additionalType) > 0 { - typ = typ + " " + additionalType - } - return + return typ + " " + additionalType } func (scope *Scope) row() *sql.Row {