MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / ForEachDocID

Method ForEachDocID

db/database.go:981–993  ·  view source on GitHub ↗

Iterates over all documents in the database, calling the callback function on each

(ctx context.Context, callback ForEachDocIDFunc, resultsOpts ForEachDocIDOptions)

Source from the content-addressed store, hash-verified

979
980// Iterates over all documents in the database, calling the callback function on each
981func (c *DatabaseCollection) ForEachDocID(ctx context.Context, callback ForEachDocIDFunc, resultsOpts ForEachDocIDOptions) error {
982
983 results, err := c.QueryAllDocs(ctx, resultsOpts.Startkey, resultsOpts.Endkey)
984 if err != nil {
985 return err
986 }
987
988 err = c.processForEachDocIDResults(ctx, callback, resultsOpts.Limit, results)
989 if err != nil {
990 return err
991 }
992 return results.Close()
993}
994
995// Iterate over the results of an AllDocs query, performing ForEachDocID handling for each row
996func (c *DatabaseCollection) processForEachDocIDResults(ctx context.Context, callback ForEachDocIDFunc, limit uint64, results sgbucket.QueryResultIterator) error {

Callers 2

handleAllDocsMethod · 0.80
allDocIDsFunction · 0.80

Calls 3

QueryAllDocsMethod · 0.95
CloseMethod · 0.65

Tested by 1

allDocIDsFunction · 0.64