(ctx context.Context)
| 578 | } |
| 579 | |
| 580 | func (cwrq *CIWorkflowResultQuery) sqlQuery(ctx context.Context) *sql.Selector { |
| 581 | builder := sql.Dialect(cwrq.driver.Dialect()) |
| 582 | t1 := builder.Table(ciworkflowresult.Table) |
| 583 | columns := cwrq.ctx.Fields |
| 584 | if len(columns) == 0 { |
| 585 | columns = ciworkflowresult.Columns |
| 586 | } |
| 587 | selector := builder.Select(t1.Columns(columns...)...).From(t1) |
| 588 | if cwrq.sql != nil { |
| 589 | selector = cwrq.sql |
| 590 | selector.Select(selector.Columns(columns...)...) |
| 591 | } |
| 592 | if cwrq.ctx.Unique != nil && *cwrq.ctx.Unique { |
| 593 | selector.Distinct() |
| 594 | } |
| 595 | for _, m := range cwrq.modifiers { |
| 596 | m(selector) |
| 597 | } |
| 598 | for _, p := range cwrq.predicates { |
| 599 | p(selector) |
| 600 | } |
| 601 | for _, p := range cwrq.order { |
| 602 | p(selector) |
| 603 | } |
| 604 | if offset := cwrq.ctx.Offset; offset != nil { |
| 605 | // limit is mandatory for offset clause. We start |
| 606 | // with default value, and override it below if needed. |
| 607 | selector.Offset(*offset).Limit(math.MaxInt32) |
| 608 | } |
| 609 | if limit := cwrq.ctx.Limit; limit != nil { |
| 610 | selector.Limit(*limit) |
| 611 | } |
| 612 | return selector |
| 613 | } |
| 614 | |
| 615 | // ForUpdate locks the selected rows against concurrent updates, and prevent them from being |
| 616 | // updated, deleted or "selected ... for update" by other sessions, until the transaction is |
no test coverage detected