Fix SqlTag() in case of ByteSlice

This commit is contained in:
HARUYAMA Seigo 2015-10-31 16:23:55 +09:00
parent 0589d36e64
commit 92f9584c83
1 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
return "hstore" return "hstore"
} }
default: default:
if isByteArray(value) { if isByteArrayOrSlice(value) {
if isUUID(value) { if isUUID(value) {
return "uuid" return "uuid"
} }
@ -65,8 +65,8 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
var byteType = reflect.TypeOf(uint8(0)) var byteType = reflect.TypeOf(uint8(0))
func isByteArray(value reflect.Value) bool { func isByteArrayOrSlice(value reflect.Value) bool {
return value.Kind() == reflect.Array && value.Type().Elem() == byteType return (value.Kind() == reflect.Array || value.Kind() == reflect.Slice) && value.Type().Elem() == byteType
} }
func isUUID(value reflect.Value) bool { func isUUID(value reflect.Value) bool {