Ordering & pagination¶
Sorting¶
Multiple calls stack into a single ORDER BY, comma-separated:
// ORDER BY priority DESC, created_at ASC
h.OrderBy().Field(&m.Priority).DESC()
h.OrderBy().Field(&m.CreatedAt).ASC()
Available in GetFirst and GetList. Count/Update/Delete don't benefit from sorting, so it's absent in their helpers.
Pagination (GetList only)¶
Page(n)— page number, 1-indexed.Size(n)— page size (LIMIT).- OFFSET is computed as
(page - 1) * size.
Page without Size
Calling Page(...) without Size(...) returns an error on Apply: "incorrect pagination: size is required then page is set".
Limit only, no offset¶
Just Size:
Page past the end¶
If OFFSET goes beyond the data, GetList returns an empty slice — no error.
Combining with filters¶
Call order doesn't matter: WHERE, ORDER BY, and LIMIT/OFFSET are assembled independently.