-
-
Save w1ck3dg0ph3r/cfbce1590fdce1ce54a179b6cb74f6a4 to your computer and use it in GitHub Desktop.
Additional test cases for sqlx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
name: `multiline indented query`, | |
query: `INSERT INTO foo ( | |
a, | |
b, | |
c, | |
d | |
) VALUES ( | |
:name, | |
:age, | |
:first, | |
:last | |
)`, | |
expect: `INSERT INTO foo ( | |
a, | |
b, | |
c, | |
d | |
) VALUES ( | |
:name, | |
:age, | |
:first, | |
:last | |
),( | |
:name, | |
:age, | |
:first, | |
:last | |
)`, | |
loop: 2, | |
}, | |
{ | |
name: `on duplicate key update`, | |
query: `INSERT INTO foo (a,b,c,d) VALUES (:name, :age, :first, :last) ON DUPLICATE KEY UPDATE b = VALUES(b), c = VALUES(c)`, | |
expect: `INSERT INTO foo (a,b,c,d) VALUES (:name, :age, :first, :last),(:name, :age, :first, :last) ON DUPLICATE KEY UPDATE b = VALUES(b), c = VALUES(c)`, | |
loop: 2, | |
}, | |
{ | |
name: `functions inside values`, | |
query: `INSERT INTO foo (a,b,c,d) VALUES (:name, cast(:age as int), :first, :last)`, | |
expect: `INSERT INTO foo (a,b,c,d) VALUES (:name, cast(:age as int), :first, :last),(:name, cast(:age as int), :first, :last)`, | |
loop: 2, | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment