dialect/sql: add support for LIMIT in update statement (#3018)

This commit is contained in:
Ariel Mashraki
2022-10-17 10:02:53 +03:00
committed by GitHub
parent bbdfea319d
commit 8d40edf24b
2 changed files with 19 additions and 3 deletions

View File

@@ -328,8 +328,8 @@ func TestBuilder(t *testing.T) {
wantArgs: []any{"foo", 10},
},
{
input: Dialect(dialect.SQLite).Update("users").Set("name", "foo").Returning("id", "name"),
wantQuery: "UPDATE `users` SET `name` = ? RETURNING `id`, `name`",
input: Dialect(dialect.SQLite).Update("users").Set("name", "foo").Returning("id", "name").OrderBy("name").Limit(10),
wantQuery: "UPDATE `users` SET `name` = ? RETURNING `id`, `name` ORDER BY `name` LIMIT 10",
wantArgs: []any{"foo"},
},
{