summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/sqlfmt.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-10-24 13:14:37 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-24 13:14:37 +0200
commit8b7c3507fe0c8f6e921ee2de2c170ef93eeb7275 (patch)
treee79e3f5a59fb8942de79955bd26bf665be0acce8 /vendor/github.com/uptrace/bun/schema/sqlfmt.go
parentdocs typo fix (#290) (diff)
downloadgotosocial-8b7c3507fe0c8f6e921ee2de2c170ef93eeb7275.tar.xz
upstep bun to v1.0.14 (#291)
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/sqlfmt.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/sqlfmt.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/sqlfmt.go b/vendor/github.com/uptrace/bun/schema/sqlfmt.go
index bbdb0a01f..93a801c86 100644
--- a/vendor/github.com/uptrace/bun/schema/sqlfmt.go
+++ b/vendor/github.com/uptrace/bun/schema/sqlfmt.go
@@ -1,5 +1,11 @@
package schema
+import (
+ "strings"
+
+ "github.com/uptrace/bun/internal"
+)
+
type QueryAppender interface {
AppendQuery(fmter Formatter, b []byte) ([]byte, error)
}
@@ -42,8 +48,13 @@ var _ QueryAppender = QueryWithArgs{}
func SafeQuery(query string, args []interface{}) QueryWithArgs {
if args == nil {
args = make([]interface{}, 0)
+ } else if len(query) > 0 && strings.IndexByte(query, '?') == -1 {
+ internal.Warn.Printf("query %q has args %v, but no placeholders", query, args)
+ }
+ return QueryWithArgs{
+ Query: query,
+ Args: args,
}
- return QueryWithArgs{Query: query, Args: args}
}
func UnsafeIdent(ident string) QueryWithArgs {