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

Function ToAttachmentStorageMeta

db/attachment.go:411–429  ·  view source on GitHub ↗

ToAttachmentStorageMeta returns a slice of AttachmentStorageMeta, which is contains the necessary metadata properties to build the key for attachment storage and retrieval.

(attachments AttachmentsMeta)

Source from the content-addressed store, hash-verified

409// ToAttachmentStorageMeta returns a slice of AttachmentStorageMeta, which is contains the
410// necessary metadata properties to build the key for attachment storage and retrieval.
411func ToAttachmentStorageMeta(attachments AttachmentsMeta) []AttachmentStorageMeta {
412 meta := make([]AttachmentStorageMeta, 0, len(attachments))
413 for name, att := range attachments {
414 if attMap, ok := att.(map[string]interface{}); ok {
415 if digest, ok := attMap["digest"]; ok {
416 if digestString, ok := digest.(string); ok {
417 version, _ := GetAttachmentVersion(attMap)
418 m := AttachmentStorageMeta{
419 digest: digestString,
420 version: version,
421 name: name,
422 }
423 meta = append(meta, m)
424 }
425 }
426 }
427 }
428 return meta
429}
430
431func DecodeAttachment(att interface{}) ([]byte, error) {
432 switch att := att.(type) {

Callers 2

sendRevisionMethod · 0.85
GetDeltaMethod · 0.85

Calls 1

GetAttachmentVersionFunction · 0.85

Tested by

no test coverage detected