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

Function TestQuery_JoinWithParams

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

Source from the content-addressed store, hash-verified

57}
58
59func TestQuery_JoinWithParams(t *testing.T) {
60 q := Q().Space("INSERT INTO users (name, email) VALUES").
61 Join(", ", "(?, ?)", "Alice", "alice@example.com").
62 Join(", ", "(?, ?)", "Bob", "bob@example.com")
63 sql, args, err := q.ToSQL()
64 require.NoError(t, err)
65 require.Equal(t, "INSERT INTO users (name, email) VALUES, ($1, $2), ($3, $4)", sql)
66 require.Equal(t, []any{"Alice", "alice@example.com", "Bob", "bob@example.com"}, args)
67}
68
69func TestQuery_NoParameters(t *testing.T) {
70 q := Q().Space("SELECT * FROM users").

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected