Merge a4b79b5c8d2c2fefcacb25d3732c7d2b38722441 into 38f96c65140f00f0b15efc495a487cfd5db510b8
This commit is contained in:
commit
7a0db74074
@ -66,8 +66,23 @@ func (s *postgres) DataTypeOf(field *StructField) string {
|
||||
if dataValue.Type().Name() == "Hstore" {
|
||||
sqlType = "hstore"
|
||||
}
|
||||
case reflect.Slice:
|
||||
if dataValue.Type().Name() == "StringArray" {
|
||||
if _, ok := field.TagSettings["SIZE"]; !ok {
|
||||
size = 0 // if SIZE haven't been set, use `text` as the default type, as there are no performance different
|
||||
}
|
||||
if size > 0 && size < 65532 {
|
||||
sqlType = fmt.Sprintf("varchar(%d)[]", size)
|
||||
} else {
|
||||
sqlType = "text[]"
|
||||
}
|
||||
break
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
if IsByteArrayOrSlice(dataValue) {
|
||||
if dataValue.Type().Name() == "RawMessage" {
|
||||
sqlType = "JSONB DEFAULT '{}'::JSONB"
|
||||
} else if IsByteArrayOrSlice(dataValue) {
|
||||
sqlType = "bytea"
|
||||
|
||||
if isUUID(dataValue) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user