Fix postgres dialect UUID sqlType evaluation (#1564)

This commit is contained in:
Dhiver 2017-09-04 16:23:42 +02:00 committed by Jinzhu
parent 750fd9030a
commit 981d5db663
1 changed files with 3 additions and 2 deletions

View File

@ -67,11 +67,12 @@ func (s *postgres) DataTypeOf(field *StructField) string {
default: default:
if IsByteArrayOrSlice(dataValue) { if IsByteArrayOrSlice(dataValue) {
sqlType = "bytea" sqlType = "bytea"
} else if isUUID(dataValue) { if isUUID(dataValue) {
sqlType = "uuid" sqlType = "uuid"
} }
} }
} }
}
if sqlType == "" { if sqlType == "" {
panic(fmt.Sprintf("invalid sql type %s (%s) for postgres", dataValue.Type().Name(), dataValue.Kind().String())) panic(fmt.Sprintf("invalid sql type %s (%s) for postgres", dataValue.Type().Name(), dataValue.Kind().String()))