summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/query_values.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/query_values.go')
-rw-r--r--vendor/github.com/uptrace/bun/query_values.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/github.com/uptrace/bun/query_values.go b/vendor/github.com/uptrace/bun/query_values.go
index 5c2abef60..97fbc65fa 100644
--- a/vendor/github.com/uptrace/bun/query_values.go
+++ b/vendor/github.com/uptrace/bun/query_values.go
@@ -14,6 +14,7 @@ type ValuesQuery struct {
customValueQuery
withOrder bool
+ comment string
}
var (
@@ -64,6 +65,12 @@ func (q *ValuesQuery) WithOrder() *ValuesQuery {
return q
}
+// Comment adds a comment to the query, wrapped by /* ... */.
+func (q *ValuesQuery) Comment(comment string) *ValuesQuery {
+ q.comment = comment
+ return q
+}
+
func (q *ValuesQuery) AppendNamedArg(fmter schema.Formatter, b []byte, name string) ([]byte, bool) {
switch name {
case "Columns":
@@ -121,6 +128,8 @@ func (q *ValuesQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, e
return nil, errNilModel
}
+ b = appendComment(b, q.comment)
+
fmter = formatterWithModel(fmter, q)
if q.tableModel != nil {
@@ -145,7 +154,7 @@ func (q *ValuesQuery) appendQuery(
fields []*schema.Field,
) (_ []byte, err error) {
b = append(b, "VALUES "...)
- if q.db.features.Has(feature.ValuesRow) {
+ if q.db.HasFeature(feature.ValuesRow) {
b = append(b, "ROW("...)
} else {
b = append(b, '(')
@@ -168,7 +177,7 @@ func (q *ValuesQuery) appendQuery(
for i := 0; i < sliceLen; i++ {
if i > 0 {
b = append(b, "), "...)
- if q.db.features.Has(feature.ValuesRow) {
+ if q.db.HasFeature(feature.ValuesRow) {
b = append(b, "ROW("...)
} else {
b = append(b, '(')