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

Function GetBodyAttachments

db/attachment.go:375–384  ·  view source on GitHub ↗

HELPERS: Returns _attachments property from body, when found. Checks for either map[string]interface{} (unmarshalled with body), or AttachmentsMeta (written by body by SG)

(body Body)

Source from the content-addressed store, hash-verified

373// Returns _attachments property from body, when found. Checks for either map[string]interface{} (unmarshalled with body),
374// or AttachmentsMeta (written by body by SG)
375func GetBodyAttachments(body Body) AttachmentsMeta {
376 switch atts := body[BodyAttachments].(type) {
377 case AttachmentsMeta:
378 return atts
379 case map[string]interface{}:
380 return AttachmentsMeta(atts)
381 default:
382 return nil
383 }
384}
385
386// AttachmentDigests returns a list of attachment digests contained in the given AttachmentsMeta
387func AttachmentDigests(attachments AttachmentsMeta) []string {

Callers 14

handleSyncFnDryRunMethod · 0.92
WriteMultipartDocumentFunction · 0.92
hasInlineAttachmentsFunction · 0.92
ReadMultipartDocumentFunction · 0.92
handlePutAttachmentMethod · 0.92
getTestRevposFunction · 0.92
PutMethod · 0.85
processRevMethod · 0.85

Calls 1

AttachmentsMetaTypeAlias · 0.85

Tested by

no test coverage detected