From 59846f0e9bf9cc2a9644d565d7a5b3bfb921f05a Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 2 Sep 2014 20:10:18 +0800 Subject: [PATCH] Fix tests for association --- field.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/field.go b/field.go index 80eca2f6..7791d42a 100644 --- a/field.go +++ b/field.go @@ -38,6 +38,10 @@ func (field *Field) IsTime() bool { func (field *Field) Set(value interface{}) (result bool) { if field.Field.IsValid() && field.Field.CanAddr() { result = true + if rvalue, ok := value.(reflect.Value); ok { + value = rvalue.Interface() + } + if scanner, ok := field.Field.Addr().Interface().(sql.Scanner); ok { scanner.Scan(value) } else if reflect.TypeOf(value).ConvertibleTo(field.Field.Type()) {