ran gofmt and did some minor tweaks to satisfy CodeClimate

This commit is contained in:
Adrian 2018-02-09 00:16:43 +08:00
parent 300cf4acd7
commit e8fa95420f

View File

@ -1,11 +1,11 @@
package gorm
import (
"encoding/json"
"fmt"
"reflect"
"strings"
"time"
"encoding/json"
)
type postgres struct {
@ -68,12 +68,14 @@ func (s *postgres) DataTypeOf(field *StructField) string {
}
default:
if IsByteArrayOrSlice(dataValue) {
sqlType = "bytea"
if isUUID(dataValue) {
sqlType = "uuid"
} else if isJSON(dataValue) {
}
if isJSON(dataValue) {
sqlType = "jsonb"
} else {
sqlType = "bytea"
}
}
}
@ -136,9 +138,6 @@ func isUUID(value reflect.Value) bool {
}
func isJSON(value reflect.Value) bool {
if _, ok := value.Interface().(json.RawMessage); ok {
return true
} else {
return false
}
_, ok := value.Interface().(json.RawMessage)
return ok
}