Skip to content

Commit

Permalink
Update sprintQ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reductionista committed Feb 7, 2024
1 parent bddc9ed commit f188c13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/services/pg/q_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ func Test_sprintQ(t *testing.T) {
{"one",
"SELECT $1 FROM table;",
[]interface{}{"foo"},
"SELECT foo FROM table;"},
"SELECT 'foo' FROM table;"},
{"two",
"SELECT $1 FROM table WHERE bar = $2;",
[]interface{}{"foo", 1},
"SELECT foo FROM table WHERE bar = 1;"},
"SELECT 'foo' FROM table WHERE bar = 1;"},
{"limit",
"SELECT $1 FROM table LIMIT $2;",
[]interface{}{"foo", Limit(10)},
"SELECT foo FROM table LIMIT 10;"},
"SELECT 'foo' FROM table LIMIT 10;"},
{"limit-all",
"SELECT $1 FROM table LIMIT $2;",
[]interface{}{"foo", Limit(-1)},
"SELECT foo FROM table LIMIT NULL;"},
"SELECT 'foo' FROM table LIMIT NULL;"},
{"bytea",
"SELECT $1 FROM table WHERE b = $2;",
[]interface{}{"foo", []byte{0x0a}},
"SELECT foo FROM table WHERE b = '\\x0a';"},
"SELECT 'foo' FROM table WHERE b = '\\x0a';"},
{"bytea[]",
"SELECT $1 FROM table WHERE b = $2;",
[]interface{}{"foo", pq.ByteaArray([][]byte{{0xa}, {0xb}})},
"SELECT foo FROM table WHERE b = ('\\x0a','\\x0b');"},
"SELECT 'foo' FROM table WHERE b = ARRAY['\\x0a','\\x0b'];"},
} {
t.Run(tt.name, func(t *testing.T) {
got := sprintQ(tt.query, tt.args)
Expand Down

0 comments on commit f188c13

Please sign in to comment.