summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/query_raw.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/query_raw.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/query_raw.go')
-rw-r--r--vendor/github.com/uptrace/bun/query_raw.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/github.com/uptrace/bun/query_raw.go b/vendor/github.com/uptrace/bun/query_raw.go
index 1634d0e5b..8c3a6a7f8 100644
--- a/vendor/github.com/uptrace/bun/query_raw.go
+++ b/vendor/github.com/uptrace/bun/query_raw.go
@@ -10,8 +10,9 @@ import (
type RawQuery struct {
baseQuery
- query string
- args []interface{}
+ query string
+ args []interface{}
+ comment string
}
// Deprecated: Use NewRaw instead. When add it to IDB, it conflicts with the sql.Conn#Raw
@@ -56,6 +57,12 @@ func (q *RawQuery) Scan(ctx context.Context, dest ...interface{}) error {
return err
}
+// Comment adds a comment to the query, wrapped by /* ... */.
+func (q *RawQuery) Comment(comment string) *RawQuery {
+ q.comment = comment
+ return q
+}
+
func (q *RawQuery) scanOrExec(
ctx context.Context, dest []interface{}, hasDest bool,
) (sql.Result, error) {
@@ -90,6 +97,8 @@ func (q *RawQuery) scanOrExec(
}
func (q *RawQuery) AppendQuery(fmter schema.Formatter, b []byte) ([]byte, error) {
+ b = appendComment(b, q.comment)
+
return fmter.AppendQuery(b, q.query, q.args...), nil
}