TestPutSelectStatementWithContent tests returning SELECT statements to pool
(t *testing.T)
| 577 | |
| 578 | // TestPutSelectStatementWithContent tests returning SELECT statements to pool |
| 579 | func 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 |
| 608 | func TestPutIdentifierWithContent(t *testing.T) { |
nothing calls this directly
no test coverage detected