mirror of
https://github.com/ent/ent.git
synced 2026-03-05 19:35:23 +03:00
fix: swap the order of handling order and pred in the graph select func (#3841)
multi order may generate predicates, so running the order funcs first allows reusing aliases
This commit is contained in:
@@ -1034,12 +1034,12 @@ func (q *query) selector(ctx context.Context) (*sql.Selector, error) {
|
||||
selector = q.From
|
||||
}
|
||||
selector.Select(selector.Columns(q.Node.Columns...)...)
|
||||
if pred := q.Predicate; pred != nil {
|
||||
pred(selector)
|
||||
}
|
||||
if order := q.Order; order != nil {
|
||||
order(selector)
|
||||
}
|
||||
if pred := q.Predicate; pred != nil {
|
||||
pred(selector)
|
||||
}
|
||||
if q.Offset != 0 {
|
||||
// Limit is mandatory for the offset clause. We start
|
||||
// with default value, and override it below if needed.
|
||||
|
||||
Reference in New Issue
Block a user