| 393 | } |
| 394 | |
| 395 | func TestQuery_Comma(t *testing.T) { |
| 396 | // Build a SET clause with comma separators |
| 397 | set := Q() |
| 398 | set.Comma("name = ?", "Alice") |
| 399 | set.Comma("email = ?", "alice@example.com") |
| 400 | set.Comma("active = ?", true) |
| 401 | |
| 402 | sql, args, err := set.ToSQL() |
| 403 | require.NoError(t, err) |
| 404 | require.Equal(t, "name = $1, email = $2, active = $3", sql) |
| 405 | require.Equal(t, []any{"Alice", "alice@example.com", true}, args) |
| 406 | } |
| 407 | |
| 408 | func TestQuery_CommaInUpdate(t *testing.T) { |
| 409 | // Realistic UPDATE with conditional SET fields |