MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestQuery_Comma

Function TestQuery_Comma

backend/common/qb/qb_test.go:395–406  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

393}
394
395func 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
408func TestQuery_CommaInUpdate(t *testing.T) {
409 // Realistic UPDATE with conditional SET fields

Callers

nothing calls this directly

Calls 4

QFunction · 0.85
CommaMethod · 0.80
ToSQLMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected