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

Method Body

db/revision_cache_interface.go:237–244  ·  view source on GitHub ↗

Body returns an unmarshalled body that is kept in the document revision to produce shallow copies. If an unmarshalled copy is not available in the document revision, it makes a copy from the raw body bytes and stores it in document revision itself before returning the body.

()

Source from the content-addressed store, hash-verified

235// If an unmarshalled copy is not available in the document revision, it makes a copy from the raw body
236// bytes and stores it in document revision itself before returning the body.
237func (rev *DocumentRevision) Body() (b Body, err error) {
238
239 if err := b.Unmarshal(rev.BodyBytes); err != nil {
240 return nil, err
241 }
242
243 return b, nil
244}
245
246// Inject1xBodyProperties will inject special properties (_rev etc) into document body avoiding unnecessary marshal work
247func (rev *DocumentRevision) Inject1xBodyProperties(ctx context.Context, db *DatabaseCollectionWithUser, requestedHistory Revisions, attachmentsSince []string, showExp bool) ([]byte, error) {

Callers 2

sendRevisionMethod · 0.95
Mutable1xBodyMethod · 0.95

Calls 1

UnmarshalMethod · 0.45

Tested by

no test coverage detected