MCPcopy
hub / github.com/perkeep/perkeep / parsePermanodeContinueToken

Function parsePermanodeContinueToken

pkg/search/query.go:176–192  ·  view source on GitHub ↗

For permanodes, the continue token is (currently!) of form "pn:nnnnnnn:sha1-xxxxx" where "pn" is a literal, "nnnnnn" is the UnixNano of the time (modified or created) and "sha1-xxxxx" was the item seen in the final result set, used as a tie breaker if multiple permanodes had the same mod/created tim

(v string)

Source from the content-addressed store, hash-verified

174// time. This format is NOT an API promise or standard and
175// clients should not rely on it. It may change without notice
176func parsePermanodeContinueToken(v string) (t time.Time, br blob.Ref, ok bool) {
177 if !strings.HasPrefix(v, "pn:") {
178 return
179 }
180 v = v[len("pn:"):]
181 col := strings.Index(v, ":")
182 if col < 0 {
183 return
184 }
185 nano, err := strconv.ParseUint(v[:col], 10, 64)
186 if err != nil {
187 return
188 }
189 t = time.Unix(0, int64(nano))
190 br, ok = blob.Parse(v[col+1:])
191 return
192}
193
194// addContinueConstraint conditionally modifies q.Constraint to scroll
195// past the results as indicated by q.Continue.

Callers 1

addContinueConstraintMethod · 0.85

Calls 3

ParseFunction · 0.92
HasPrefixMethod · 0.80
IndexMethod · 0.80

Tested by

no test coverage detected