ToAttachmentStorageMeta returns a slice of AttachmentStorageMeta, which is contains the necessary metadata properties to build the key for attachment storage and retrieval.
(attachments AttachmentsMeta)
| 409 | // ToAttachmentStorageMeta returns a slice of AttachmentStorageMeta, which is contains the |
| 410 | // necessary metadata properties to build the key for attachment storage and retrieval. |
| 411 | func 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 | |
| 431 | func DecodeAttachment(att interface{}) ([]byte, error) { |
| 432 | switch att := att.(type) { |
no test coverage detected