MCPcopy Create free account
hub / github.com/google/go-cloud / Offset

Method Offset

docstore/query.go:128–140  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
128func (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.

Callers 2

TestInvalidQueryFunction · 0.80
testGetQueryFunction · 0.80

Calls 1

invalidfMethod · 0.95

Tested by 1

TestInvalidQueryFunction · 0.64