This repository has been archived on 2022-10-02. You can view files and clone it, but cannot push or open issues or pull requests.
2020-10-17 10:43:27 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2020-11-21 12:13:29 +00:00
|
|
|
func addPrefixToColumnName(column, prefix string) string {
|
|
|
|
if prefix != "" && !strings.HasPrefix(column, prefix+".") {
|
|
|
|
column = wrapStringInDoubleQuotes(prefix) + "." + wrapStringInDoubleQuotes(column)
|
2020-10-17 10:43:27 +00:00
|
|
|
} else {
|
2020-11-21 12:13:29 +00:00
|
|
|
column = wrapStringInDoubleQuotes(column)
|
2020-10-17 10:43:27 +00:00
|
|
|
}
|
2020-11-21 12:13:29 +00:00
|
|
|
return column
|
2020-10-17 10:43:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func wrapStringInDoubleQuotes(str string) string {
|
|
|
|
return `"` + str + `"`
|
|
|
|
}
|