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

Function TestQuery_JSONBMixedOperators

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

Source from the content-addressed store, hash-verified

339}
340
341func TestQuery_JSONBMixedOperators(t *testing.T) {
342 // Test mixing JSONB operators with regular parameters
343 q := Q().Space("SELECT * FROM tasks").
344 Where("instance = ?", "prod").
345 And("payload ?? 'type'").
346 And("payload->>'status' = ?", "completed")
347 sql, args, err := q.ToSQL()
348 require.NoError(t, err)
349 require.Equal(t, "SELECT * FROM tasks WHERE instance = $1 AND payload ? 'type' AND payload->>'status' = $2", sql)
350 require.Equal(t, []any{"prod", "completed"}, args)
351}
352
353func TestQuery_JSONBComplexQuery(t *testing.T) {
354 // Realistic example from the codebase

Callers

nothing calls this directly

Calls 6

QFunction · 0.85
AndMethod · 0.80
WhereMethod · 0.80
SpaceMethod · 0.80
ToSQLMethod · 0.80
EqualMethod · 0.65

Tested by

no test coverage detected