Add join with where using args test
This commit is contained in:
parent
4571184b7d
commit
4b27cea3a6
6 changed files with 13 additions and 4 deletions
|
@ -1 +1 @@
|
|||
SELECT * FROM "a" WHERE (a=$1 or b=$2) AND (c=$3) GROUP BY id, name HAVING id <> ?, length(name, ?) > ?;
|
||||
SELECT "videos".* FROM "videos" INNER JOIN (select id from users where deleted = ?) u on u.id = videos.user_id WHERE (videos.deleted = $2);
|
|
@ -1 +1 @@
|
|||
DELETE FROM thing happy, upset as "sad", "fun", thing as stuff, "angry" as mad WHERE (a=$1) AND (b=$2) AND (c=$3);
|
||||
SELECT * FROM "a" WHERE (a=$1 or b=$2) AND (c=$3) GROUP BY id, name HAVING id <> ?, length(name, ?) > ?;
|
|
@ -1 +1 @@
|
|||
DELETE FROM thing happy, upset as "sad", "fun", thing as stuff, "angry" as mad WHERE ((id=$1 and thing=$2) or stuff=$3) LIMIT 5;
|
||||
DELETE FROM thing happy, upset as "sad", "fun", thing as stuff, "angry" as mad WHERE (a=$1) AND (b=$2) AND (c=$3);
|
|
@ -1 +1 @@
|
|||
UPDATE thing happy, "fun", "stuff" SET ("col2", "fun"."col3", "col1") = ($1, $2, $3) WHERE (aa=$4 or bb=$5 or cc=$6) OR (dd=$7 or ee=$8 or ff=$9 and gg=$10) LIMIT 5;
|
||||
DELETE FROM thing happy, upset as "sad", "fun", thing as stuff, "angry" as mad WHERE ((id=$1 and thing=$2) or stuff=$3) LIMIT 5;
|
1
boil/_fixtures/11.sql
Normal file
1
boil/_fixtures/11.sql
Normal file
|
@ -0,0 +1 @@
|
|||
UPDATE thing happy, "fun", "stuff" SET ("col2", "fun"."col3", "col1") = ($1, $2, $3) WHERE (aa=$4 or bb=$5 or cc=$6) OR (dd=$7 or ee=$8 or ff=$9 and gg=$10) LIMIT 5;
|
|
@ -39,6 +39,14 @@ func TestBuildQuery(t *testing.T) {
|
|||
from: []string{"happiness as a"},
|
||||
joins: []join{{clause: "rainbows r on a.id = r.happy_id"}},
|
||||
}, nil},
|
||||
{&Query{
|
||||
from: []string{"videos"},
|
||||
joins: []join{{
|
||||
clause: "(select id from users where deleted = ?) u on u.id = videos.user_id",
|
||||
args: []interface{}{true},
|
||||
}},
|
||||
where: []where{{clause: "videos.deleted = ?", args: []interface{}{false}}},
|
||||
}, []interface{}{true, false}},
|
||||
{&Query{
|
||||
from: []string{"a"},
|
||||
groupBy: []string{"id", "name"},
|
||||
|
|
Loading…
Add table
Reference in a new issue