Fix to support period in DefaultTableNameHandler results. This is most definitely a hack, but its in place until we remove gorm completely during dm consolidation.
This commit is contained in:
parent
f9223721cf
commit
64155294ca
14
postgres.go
14
postgres.go
@ -60,7 +60,19 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s postgres) ReturningStr(tableName, key string) string {
|
func (s postgres) ReturningStr(tableName, key string) string {
|
||||||
return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
|
return fmt.Sprintf("RETURNING %v.%v", s.quoteSplitPeriods(tableName), key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s postgres) quoteSplitPeriods(str string) string {
|
||||||
|
if strings.Index(str, ".") != -1 {
|
||||||
|
newStrs := []string{}
|
||||||
|
for _, str := range strings.Split(str, ".") {
|
||||||
|
newStrs = append(newStrs, s.Quote(str))
|
||||||
|
}
|
||||||
|
return strings.Join(newStrs, ".")
|
||||||
|
} else {
|
||||||
|
return s.Quote(str)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (postgres) HasTable(scope *Scope, tableName string) bool {
|
func (postgres) HasTable(scope *Scope, tableName string) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user