Offset (also commonly referred to as `Skip`) specifies the number of documents to skip before returning results. n must be non-negative. It is an error to specify Offset more than once in a Get query, or at all in a Delete or Update query.
(n int)
| 126 | // It is an error to specify Offset more than once in a Get query, or |
| 127 | // at all in a Delete or Update query. |
| 128 | func (q *Query) Offset(n int) *Query { |
| 129 | if q.err != nil { |
| 130 | return q |
| 131 | } |
| 132 | if n < 0 { |
| 133 | return q.invalidf("offset value of %d must be non-negative", n) |
| 134 | } |
| 135 | if q.dq.Offset > 0 { |
| 136 | return q.invalidf("query can have at most one offset clause") |
| 137 | } |
| 138 | q.dq.Offset = n |
| 139 | return q |
| 140 | } |
| 141 | |
| 142 | // Limit will limit the results to at most n documents. |
| 143 | // n must be positive. |