(ctx context.Context)
| 1077 | } |
| 1078 | |
| 1079 | func (uq *UserQuery) sqlQuery(ctx context.Context) *sql.Selector { |
| 1080 | builder := sql.Dialect(uq.driver.Dialect()) |
| 1081 | t1 := builder.Table(user.Table) |
| 1082 | columns := uq.ctx.Fields |
| 1083 | if len(columns) == 0 { |
| 1084 | columns = user.Columns |
| 1085 | } |
| 1086 | selector := builder.Select(t1.Columns(columns...)...).From(t1) |
| 1087 | if uq.sql != nil { |
| 1088 | selector = uq.sql |
| 1089 | selector.Select(selector.Columns(columns...)...) |
| 1090 | } |
| 1091 | if uq.ctx.Unique != nil && *uq.ctx.Unique { |
| 1092 | selector.Distinct() |
| 1093 | } |
| 1094 | for _, p := range uq.predicates { |
| 1095 | p(selector) |
| 1096 | } |
| 1097 | for _, p := range uq.order { |
| 1098 | p(selector) |
| 1099 | } |
| 1100 | if offset := uq.ctx.Offset; offset != nil { |
| 1101 | // limit is mandatory for offset clause. We start |
| 1102 | // with default value, and override it below if needed. |
| 1103 | selector.Offset(*offset).Limit(math.MaxInt32) |
| 1104 | } |
| 1105 | if limit := uq.ctx.Limit; limit != nil { |
| 1106 | selector.Limit(*limit) |
| 1107 | } |
| 1108 | return selector |
| 1109 | } |
| 1110 | |
| 1111 | // UserGroupBy is the group-by builder for User entities. |
| 1112 | type UserGroupBy struct { |
no test coverage detected