(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestDeleteBuilderToSql(t *testing.T) { |
| 10 | b := Delete(""). |
| 11 | Prefix("WITH prefix AS ?", 0). |
| 12 | From("a"). |
| 13 | Where("b = ?", 1). |
| 14 | OrderBy("c"). |
| 15 | Limit(2). |
| 16 | Offset(3). |
| 17 | Suffix("RETURNING ?", 4) |
| 18 | |
| 19 | sql, args, err := b.ToSql() |
| 20 | assert.NoError(t, err) |
| 21 | |
| 22 | expectedSql := |
| 23 | "WITH prefix AS ? " + |
| 24 | "DELETE FROM a WHERE b = ? ORDER BY c LIMIT 2 OFFSET 3 " + |
| 25 | "RETURNING ?" |
| 26 | assert.Equal(t, expectedSql, sql) |
| 27 | |
| 28 | expectedArgs := []interface{}{0, 1, 4} |
| 29 | assert.Equal(t, expectedArgs, args) |
| 30 | } |
| 31 | |
| 32 | func TestDeleteBuilderToSqlErr(t *testing.T) { |
| 33 | _, _, err := Delete("").ToSql() |
nothing calls this directly
no test coverage detected
searching dependent graphs…