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

Method getRevisionBodyJSON

db/document.go:795–807  ·  view source on GitHub ↗

Fetches the body of a revision as JSON, or nil if it's not available.

(ctx context.Context, revid string, loader RevLoaderFunc)

Source from the content-addressed store, hash-verified

793
794// Fetches the body of a revision as JSON, or nil if it's not available.
795func (doc *Document) getRevisionBodyJSON(ctx context.Context, revid string, loader RevLoaderFunc) []byte {
796 var bodyJSON []byte
797 if revid == doc.GetRevTreeID() {
798 var marshalErr error
799 bodyJSON, marshalErr = doc.BodyBytes(ctx)
800 if marshalErr != nil {
801 base.WarnfCtx(ctx, "Marshal error when retrieving active current revision body: %v", marshalErr)
802 }
803 } else {
804 bodyJSON, _ = doc.History.getRevisionBody(revid, loader)
805 }
806 return bodyJSON
807}
808
809func (doc *Document) removeRevisionBody(ctx context.Context, revID string) {
810 removedBodyKey := doc.History.removeRevisionBody(ctx, revID)

Callers 3

getRevisionMethod · 0.80
getAncestorJSONMethod · 0.80
backupAncestorRevsMethod · 0.80

Calls 4

BodyBytesMethod · 0.95
WarnfCtxFunction · 0.92
getRevisionBodyMethod · 0.80
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected