mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
add offset step to query builder (#1049)
Summary: Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1049 Useful for real paging Reviewed By: noamsch Differential Revision: D16003607 fbshipit-source-id: 6a85d0e3d71a2582bc3cd8f1d66748dda4f2a10e
This commit is contained in:
committed by
Facebook Github Bot
parent
6c2813b7b5
commit
37ae2b744e
@@ -80,6 +80,11 @@ func ({{ $receiver }} *{{ $builder }}) sqlQuery() *sql.Selector {
|
||||
for _, p := range {{ $receiver }}.order {
|
||||
p.SQL(selector)
|
||||
}
|
||||
if offset := {{ $receiver }}.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.MaxInt64)
|
||||
}
|
||||
if limit := {{ $receiver }}.limit; limit != nil {
|
||||
selector.Limit(*limit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user