summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/util.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2025-01-14 14:23:28 +0000
committerLibravatar GitHub <noreply@github.com>2025-01-14 14:23:28 +0000
commitb8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9 (patch)
tree68eaf966c80237e18993e887c8583355f0943ca7 /vendor/github.com/uptrace/bun/util.go
parent[chore] better dns validation (#3644) (diff)
downloadgotosocial-b8ef9fc4bcccc6c024edaa8e9c91a6bf87f83dd9.tar.xz
bump uptrace/bun dependencies from 1.2.6 to 1.2.8 (#3645)
Diffstat (limited to 'vendor/github.com/uptrace/bun/util.go')
-rw-r--r--vendor/github.com/uptrace/bun/util.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/vendor/github.com/uptrace/bun/util.go b/vendor/github.com/uptrace/bun/util.go
index 09ffbb996..97ed9228a 100644
--- a/vendor/github.com/uptrace/bun/util.go
+++ b/vendor/github.com/uptrace/bun/util.go
@@ -1,6 +1,10 @@
package bun
-import "reflect"
+import (
+ "fmt"
+ "reflect"
+ "strings"
+)
func indirect(v reflect.Value) reflect.Value {
switch v.Kind() {
@@ -66,3 +70,19 @@ func sliceElemType(v reflect.Value) reflect.Type {
}
return indirectType(elemType)
}
+
+// appendComment adds comment in the header of the query into buffer
+func appendComment(b []byte, name string) []byte {
+ if name == "" {
+ return b
+ }
+ name = strings.Map(func(r rune) rune {
+ if r == '\x00' {
+ return -1
+ }
+ return r
+ }, name)
+ name = strings.ReplaceAll(name, `/*`, `/\*`)
+ name = strings.ReplaceAll(name, `*/`, `*\/`)
+ return append(b, fmt.Sprintf("/* %s */ ", name)...)
+}