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

Method MarshalBodyAndSync

db/document.go:326–332  ·  view source on GitHub ↗

Marshals both the body and sync data for a given document. If there is no rawbody already available then we will marshall it all in one go. Otherwise we will reduce marshalling as much as possible by only marshalling the sync data and injecting it into the existing raw body.

()

Source from the content-addressed store, hash-verified

324// marshall it all in one go. Otherwise we will reduce marshalling as much as possible by only marshalling the sync data
325// and injecting it into the existing raw body.
326func (doc *Document) MarshalBodyAndSync() (retBytes []byte, err error) {
327 if doc._rawBody != nil {
328 return base.InjectJSONProperties(doc._rawBody, base.KVPair{Key: base.SyncPropertyName, Val: doc.SyncData})
329 } else {
330 return base.JSONMarshal(doc)
331 }
332}
333
334func (doc *Document) IsDeleted() bool {
335 return doc.hasFlag(channels.Deleted)

Callers 1

importDocMethod · 0.80

Calls 2

InjectJSONPropertiesFunction · 0.92
JSONMarshalFunction · 0.92

Tested by

no test coverage detected