Retrieves rev with request history specified as collection of revids (historyFrom)
(ctx context.Context, docid, revOrCV string, opts Get1xRevBodyOptions)
| 311 | |
| 312 | // Retrieves rev with request history specified as collection of revids (historyFrom) |
| 313 | func (db *DatabaseCollectionWithUser) Get1xRevBodyWithHistory(ctx context.Context, docid, revOrCV string, opts Get1xRevBodyOptions) (Body, error) { |
| 314 | rev, err := db.getRev(ctx, docid, revOrCV, opts.MaxHistory, opts.HistoryFrom) |
| 315 | if err != nil { |
| 316 | return nil, err |
| 317 | } |
| 318 | |
| 319 | // RequestedHistory is the _revisions returned in the body. Avoids mutating revision.History, in case it's needed |
| 320 | // during attachment processing below |
| 321 | requestedHistory := rev.History |
| 322 | if opts.MaxHistory == 0 { |
| 323 | requestedHistory = nil |
| 324 | } |
| 325 | if requestedHistory != nil { |
| 326 | _, requestedHistory = trimEncodedRevisionsToAncestor(ctx, requestedHistory, opts.HistoryFrom, opts.MaxHistory) |
| 327 | } |
| 328 | |
| 329 | return rev.Mutable1xBody(ctx, db, requestedHistory, opts.AttachmentsSince, opts.ShowExp, opts.ShowCV) |
| 330 | } |
| 331 | |
| 332 | // Underlying revision retrieval used by Get1xRevBody, Get1xRevBodyWithHistory, GetRevCopy. |
| 333 | // Returns the revision of a document using the revision cache. |
no test coverage detected