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

Function TestQuery_ChainedCalls

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

Source from the content-addressed store, hash-verified

142}
143
144func TestQuery_ChainedCalls(t *testing.T) {
145 // Test that we can chain calls continuously
146 sql, args, err := Q().
147 Space("SELECT * FROM users").
148 Where("status = ?", "active").
149 And("role = ?", "admin").
150 Space("ORDER BY created_at DESC").
151 ToSQL()
152 require.NoError(t, err)
153 require.Equal(t, "SELECT * FROM users WHERE status = $1 AND role = $2 ORDER BY created_at DESC", sql)
154 require.Equal(t, []any{"active", "admin"}, args)
155}
156
157func TestQuery_ConditionalBuilding(t *testing.T) {
158 // Simulate building a query with optional filters

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected