asDocumentRevision copies the rev cache value into a DocumentRevision. Should only be called for non-empty revCacheValues - copies all immutable revCacheValue properties, and adds the provided body/delta.
(delta *RevisionDelta)
| 730 | // asDocumentRevision copies the rev cache value into a DocumentRevision. Should only be called for non-empty |
| 731 | // revCacheValues - copies all immutable revCacheValue properties, and adds the provided body/delta. |
| 732 | func (value *revCacheValue) asDocumentRevision(delta *RevisionDelta) (DocumentRevision, error) { |
| 733 | |
| 734 | docRev := DocumentRevision{ |
| 735 | DocID: value.id, |
| 736 | RevID: value.revID, |
| 737 | BodyBytes: value.bodyBytes, |
| 738 | History: value.history, |
| 739 | Channels: value.channels, |
| 740 | Expiry: value.expiry, |
| 741 | Attachments: value.attachments.ShallowCopy(), // Avoid caller mutating the stored attachments |
| 742 | Delta: delta, |
| 743 | Deleted: value.deleted, |
| 744 | Removed: value.removed, |
| 745 | HlvHistory: value.hlvHistory, |
| 746 | RevCacheValueDeltaLock: &value.deltaLock, |
| 747 | } |
| 748 | // only populate CV if we have a value |
| 749 | if !value.cv.IsEmpty() { |
| 750 | docRev.CV = &value.cv |
| 751 | } |
| 752 | |
| 753 | return docRev, value.err |
| 754 | } |
| 755 | |
| 756 | // Retrieves the body etc. out of a revCacheValue. If they aren't already present, loads into the cache value using |
| 757 | // the provided document. |
no test coverage detected