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

Function docVersionFromOCCValue

rest/doc_api.go:784–797  ·  view source on GitHub ↗

docVersionFromOCCValue converts an OCC value and type into a DocVersion struct.

(occValue string, occValueType occVersionType)

Source from the content-addressed store, hash-verified

782
783// docVersionFromOCCValue converts an OCC value and type into a DocVersion struct.
784func docVersionFromOCCValue(occValue string, occValueType occVersionType) (docVersion db.DocVersion, err error) {
785 switch occValueType {
786 case VersionTypeRevTreeID:
787 docVersion.RevTreeID = occValue
788 case VersionTypeCV:
789 docVersion.CV, err = db.ParseVersion(occValue)
790 if err != nil {
791 return DocVersion{}, base.HTTPErrorf(http.StatusBadRequest, "Invalid CV: %v", err)
792 }
793 default:
794 return DocVersion{}, base.HTTPErrorf(http.StatusBadRequest, "Unknown OCC version type: %d", occValueType)
795 }
796 return docVersion, nil
797}
798
799// HTTP handler for a DELETE of a document
800func (h *handler) handleDeleteDoc() error {

Callers 1

handleDeleteDocMethod · 0.85

Calls 2

ParseVersionFunction · 0.92
HTTPErrorfFunction · 0.92

Tested by

no test coverage detected