-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Hi @jmoiron and thanks for your work on this lib!
On the following example: http://jmoiron.github.io/sqlx/#namedParams, you show how to combine Named params and IN, in a single statement.
This is broken since -at least- [email protected] and on master branch.
Example with the following table:
CREATE TABLE (foo text, bar text);The following code:
type Test struct {
Foo string `db:"foo"`
Bar string `db:"bar"`
}
test := []Test{
{Foo: "hello", Bar: "world 1"},
{Foo: "hello", Bar: "world 2"},
}
query := "INSERT INTO test (foo, bar) VALUES (:foo, :bar);"
query, args, err := sqlx.Named(, arg)
query, args, err := sqlx.In(query, args...)
query = db.Rebind(query)
_, err := db.Query(query, args...)
fmt.Println(err.Error())
// "pq: got 4 parameters but the statement requires 2"
fmt.Println(query)
// "INSERT INTO test (foo, bar) VALUES (?, ?);"
fmt.Println(args)
// [hello world 1 hello world 2]Any idea?
kgritesh, pete-woods, bradleygore, gnuletik and tkingsbury42
Metadata
Metadata
Assignees
Labels
No labels