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

Method getAncestorJSON

db/crud.go:809–817  ·  view source on GitHub ↗

Gets the body of a revision's nearest ancestor, as raw JSON (without _id or _rev.) If no ancestor has any JSON, returns nil but no error.

(ctx context.Context, doc *Document, revid string)

Source from the content-addressed store, hash-verified

807// Gets the body of a revision's nearest ancestor, as raw JSON (without _id or _rev.)
808// If no ancestor has any JSON, returns nil but no error.
809func (db *DatabaseCollectionWithUser) getAncestorJSON(ctx context.Context, doc *Document, revid string) ([]byte, error) {
810 for {
811 if revid = doc.History.getParent(revid); revid == "" {
812 return nil, nil
813 } else if body := doc.getRevisionBodyJSON(ctx, revid, db.RevisionBodyLoader); body != nil {
814 return body, nil
815 }
816 }
817}
818
819// Returns the body of a revision given a document struct. Checks user access.
820// If the user is not authorized to see the specific revision they asked for,

Callers 1

getChannelsAndAccessMethod · 0.95

Calls 2

getParentMethod · 0.80
getRevisionBodyJSONMethod · 0.80

Tested by

no test coverage detected