debugging

This commit is contained in:
Jay Taylor 2016-06-23 06:43:09 -07:00
parent 1485f4bce9
commit 977a60eb3f

View File

@ -3,6 +3,7 @@ package gorm_test
import ( import (
"database/sql/driver" "database/sql/driver"
"encoding/json" "encoding/json"
"fmt"
"testing" "testing"
) )
@ -51,6 +52,12 @@ func (l ExampleStringSlice) Value() (driver.Value, error) {
} }
func (l *ExampleStringSlice) Scan(input interface{}) error { func (l *ExampleStringSlice) Scan(input interface{}) error {
switch input.(type) {
case string:
fmt.Printf("string: %+v\n", input.(string))
case []byte:
fmt.Printf("[]byte: %+v\n", string(input.([]byte)))
}
return json.Unmarshal(input.([]byte), l) return json.Unmarshal(input.([]byte), l)
} }