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

Function TestQuery_MultilineSQL

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

Source from the content-addressed store, hash-verified

127}
128
129func TestQuery_MultilineSQL(t *testing.T) {
130 q := Q().Space(`
131 SELECT
132 id,
133 name,
134 email
135 FROM users
136 `).Where("id = ?", 123)
137 sql, args, err := q.ToSQL()
138 require.NoError(t, err)
139 require.Contains(t, sql, "SELECT")
140 require.Contains(t, sql, "WHERE id = $1")
141 require.Equal(t, []any{123}, args)
142}
143
144func TestQuery_ChainedCalls(t *testing.T) {
145 // Test that we can chain calls continuously

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected