(ctx context.Context)
| 1091 | } |
| 1092 | |
| 1093 | func (_q *UserQuery) sqlQuery(ctx context.Context) *sql.Selector { |
| 1094 | builder := sql.Dialect(_q.driver.Dialect()) |
| 1095 | t1 := builder.Table(user.Table) |
| 1096 | columns := _q.ctx.Fields |
| 1097 | if len(columns) == 0 { |
| 1098 | columns = user.Columns |
| 1099 | } |
| 1100 | selector := builder.Select(t1.Columns(columns...)...).From(t1) |
| 1101 | if _q.sql != nil { |
| 1102 | selector = _q.sql |
| 1103 | selector.Select(selector.Columns(columns...)...) |
| 1104 | } |
| 1105 | if _q.ctx.Unique != nil && *_q.ctx.Unique { |
| 1106 | selector.Distinct() |
| 1107 | } |
| 1108 | t1.Schema(_q.schemaConfig.User) |
| 1109 | ctx = internal.NewSchemaConfigContext(ctx, _q.schemaConfig) |
| 1110 | selector.WithContext(ctx) |
| 1111 | for _, m := range _q.modifiers { |
| 1112 | m(selector) |
| 1113 | } |
| 1114 | for _, p := range _q.predicates { |
| 1115 | p(selector) |
| 1116 | } |
| 1117 | for _, p := range _q.order { |
| 1118 | p(selector) |
| 1119 | } |
| 1120 | if offset := _q.ctx.Offset; offset != nil { |
| 1121 | // limit is mandatory for offset clause. We start |
| 1122 | // with default value, and override it below if needed. |
| 1123 | selector.Offset(*offset).Limit(math.MaxInt32) |
| 1124 | } |
| 1125 | if limit := _q.ctx.Limit; limit != nil { |
| 1126 | selector.Limit(*limit) |
| 1127 | } |
| 1128 | return selector |
| 1129 | } |
| 1130 | |
| 1131 | // Modify adds a query modifier for attaching custom logic to queries. |
| 1132 | func (_q *UserQuery) Modify(modifiers ...func(s *sql.Selector)) *UserSelect { |
no test coverage detected