diff options
| author | 2021-10-24 13:14:37 +0200 | |
|---|---|---|
| committer | 2021-10-24 13:14:37 +0200 | |
| commit | 8b7c3507fe0c8f6e921ee2de2c170ef93eeb7275 (patch) | |
| tree | e79e3f5a59fb8942de79955bd26bf665be0acce8 /vendor/github.com/uptrace/bun/schema/sqlfmt.go | |
| parent | docs typo fix (#290) (diff) | |
| download | gotosocial-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.go | 13 |
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 { |
