summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/dialect/append.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/dialect/append.go')
-rw-r--r--vendor/github.com/uptrace/bun/dialect/append.go25
1 files changed, 21 insertions, 4 deletions
diff --git a/vendor/github.com/uptrace/bun/dialect/append.go b/vendor/github.com/uptrace/bun/dialect/append.go
index 0a25ee22d..48f092284 100644
--- a/vendor/github.com/uptrace/bun/dialect/append.go
+++ b/vendor/github.com/uptrace/bun/dialect/append.go
@@ -48,14 +48,31 @@ func appendFloat(b []byte, v float64, bitSize int) []byte {
//------------------------------------------------------------------------------
-func AppendIdent(b []byte, field string, quote byte) []byte {
- return appendIdent(b, internal.Bytes(field), quote)
+func AppendName(b []byte, ident string, quote byte) []byte {
+ return appendName(b, internal.Bytes(ident), quote)
}
-func appendIdent(b, src []byte, quote byte) []byte {
+func appendName(b, ident []byte, quote byte) []byte {
+ b = append(b, quote)
+ for _, c := range ident {
+ if c == quote {
+ b = append(b, quote, quote)
+ } else {
+ b = append(b, c)
+ }
+ }
+ b = append(b, quote)
+ return b
+}
+
+func AppendIdent(b []byte, name string, quote byte) []byte {
+ return appendIdent(b, internal.Bytes(name), quote)
+}
+
+func appendIdent(b, name []byte, quote byte) []byte {
var quoted bool
loop:
- for _, c := range src {
+ for _, c := range name {
switch c {
case '*':
if !quoted {