MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestPutSelectStatementWithContent

Function TestPutSelectStatementWithContent

pkg/sql/ast/coverage_test.go:579–605  ·  view source on GitHub ↗

TestPutSelectStatementWithContent tests returning SELECT statements to pool

(t *testing.T)

Source from the content-addressed store, hash-verified

577
578// TestPutSelectStatementWithContent tests returning SELECT statements to pool
579func TestPutSelectStatementWithContent(t *testing.T) {
580 sel := GetSelectStatement()
581 sel.Distinct = true
582 sel.Columns = []Expression{
583 &Identifier{Name: "id"},
584 &FunctionCall{Name: "COUNT", Arguments: []Expression{&Identifier{Name: "*"}}},
585 }
586 sel.From = []TableReference{
587 {Name: "users"},
588 }
589 sel.Where = &BinaryExpression{
590 Left: &Identifier{Name: "active"},
591 Right: &LiteralValue{Value: true},
592 Operator: "=",
593 }
594 sel.GroupBy = []Expression{&Identifier{Name: "department"}}
595 sel.Having = &BinaryExpression{
596 Left: &FunctionCall{Name: "COUNT", Arguments: []Expression{&Identifier{Name: "*"}}},
597 Right: &LiteralValue{Value: 10},
598 Operator: ">=",
599 }
600 sel.OrderBy = []OrderByExpression{
601 {Expression: &Identifier{Name: "name"}, Ascending: true},
602 }
603
604 PutSelectStatement(sel)
605}
606
607// TestPutIdentifierWithContent tests returning Identifiers to pool
608func TestPutIdentifierWithContent(t *testing.T) {

Callers

nothing calls this directly

Calls 2

GetSelectStatementFunction · 0.85
PutSelectStatementFunction · 0.85

Tested by

no test coverage detected