-
Notifications
You must be signed in to change notification settings - Fork 986
Open
Description
In template, the modifiers template apply earlier than some other options, which makes the modifiers cannot change some options like order or limit and so on.
ent/entc/gen/template/dialect/sql/query.tmpl
Lines 374 to 393 in 9442826
| {{- /* Allow mutating the sql.Selector by ent extensions or user templates.*/}} | |
| {{- with $tmpls := matchTemplate "dialect/sql/query/selector/*" }} | |
| {{- range $tmpl := $tmpls }} | |
| {{- xtemplate $tmpl $ }} | |
| {{- end }} | |
| {{- end }} | |
| for _, p := range {{ $receiver }}.predicates { | |
| p(selector) | |
| } | |
| for _, p := range {{ $receiver }}.order { | |
| p(selector) | |
| } | |
| if offset := {{ $receiver }}.ctx.Offset; offset != nil { | |
| // limit is mandatory for offset clause. We start | |
| // with default value, and override it below if needed. | |
| selector.Offset(*offset).Limit(math.MaxInt32) | |
| } | |
| if limit := {{ $receiver }}.ctx.Limit; limit != nil { | |
| selector.Limit(*limit) | |
| } |
Should we apply the mutating templates whe all other options are applyed?
Metadata
Metadata
Assignees
Labels
No labels