(ctx context.Context)
| 715 | } |
| 716 | |
| 717 | func (_q *AlertQuery) sqlQuery(ctx context.Context) *sql.Selector { |
| 718 | builder := sql.Dialect(_q.driver.Dialect()) |
| 719 | t1 := builder.Table(alert.Table) |
| 720 | columns := _q.ctx.Fields |
| 721 | if len(columns) == 0 { |
| 722 | columns = alert.Columns |
| 723 | } |
| 724 | selector := builder.Select(t1.Columns(columns...)...).From(t1) |
| 725 | if _q.sql != nil { |
| 726 | selector = _q.sql |
| 727 | selector.Select(selector.Columns(columns...)...) |
| 728 | } |
| 729 | if _q.ctx.Unique != nil && *_q.ctx.Unique { |
| 730 | selector.Distinct() |
| 731 | } |
| 732 | for _, p := range _q.predicates { |
| 733 | p(selector) |
| 734 | } |
| 735 | for _, p := range _q.order { |
| 736 | p(selector) |
| 737 | } |
| 738 | if offset := _q.ctx.Offset; offset != nil { |
| 739 | // limit is mandatory for offset clause. We start |
| 740 | // with default value, and override it below if needed. |
| 741 | selector.Offset(*offset).Limit(math.MaxInt32) |
| 742 | } |
| 743 | if limit := _q.ctx.Limit; limit != nil { |
| 744 | selector.Limit(*limit) |
| 745 | } |
| 746 | return selector |
| 747 | } |
| 748 | |
| 749 | // AlertGroupBy is the group-by builder for Alert entities. |
| 750 | type AlertGroupBy struct { |
no test coverage detected