From 92f9584c837c28c80bc164f319afb1b442d06750 Mon Sep 17 00:00:00 2001 From: HARUYAMA Seigo Date: Sat, 31 Oct 2015 16:23:55 +0900 Subject: [PATCH] Fix SqlTag() in case of ByteSlice --- postgres.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postgres.go b/postgres.go index 3753f12b..a6d98ae3 100644 --- a/postgres.go +++ b/postgres.go @@ -53,7 +53,7 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string return "hstore" } default: - if isByteArray(value) { + if isByteArrayOrSlice(value) { if isUUID(value) { return "uuid" } @@ -65,8 +65,8 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string var byteType = reflect.TypeOf(uint8(0)) -func isByteArray(value reflect.Value) bool { - return value.Kind() == reflect.Array && value.Type().Elem() == byteType +func isByteArrayOrSlice(value reflect.Value) bool { + return (value.Kind() == reflect.Array || value.Kind() == reflect.Slice) && value.Type().Elem() == byteType } func isUUID(value reflect.Value) bool {