mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
dialect/sql: append UNION before ORDER BY (#1761)
* fix: builder to append UNION before ORDER_BY * gofmt builder_test.go
This commit is contained in:
@@ -2320,6 +2320,9 @@ func (s *Selector) Query() (string, []interface{}) {
|
||||
b.WriteString(" HAVING ")
|
||||
b.Join(s.having)
|
||||
}
|
||||
if len(s.union) > 0 {
|
||||
s.joinUnion(&b)
|
||||
}
|
||||
if len(s.order) > 0 {
|
||||
s.joinOrder(&b)
|
||||
}
|
||||
@@ -2331,9 +2334,6 @@ func (s *Selector) Query() (string, []interface{}) {
|
||||
b.WriteString(" OFFSET ")
|
||||
b.WriteString(strconv.Itoa(*s.offset))
|
||||
}
|
||||
if len(s.union) > 0 {
|
||||
s.joinUnion(&b)
|
||||
}
|
||||
s.joinLock(&b)
|
||||
s.total = b.total
|
||||
s.AddError(b.Err())
|
||||
|
||||
Reference in New Issue
Block a user