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

Function compareRevIDs

db/revision.go:465–479  ·  view source on GitHub ↗

compareRevIDs compares the two rev IDs and returns: 1 if id1 is 'greater' than id2 -1 if id1 is 'less' than id2 0 if the two are equal.

(ctx context.Context, id1, id2 string)

Source from the content-addressed store, hash-verified

463// -1 if id1 is 'less' than id2
464// 0 if the two are equal.
465func compareRevIDs(ctx context.Context, id1, id2 string) int {
466 gen1, sha1 := ParseRevID(ctx, id1)
467 gen2, sha2 := ParseRevID(ctx, id2)
468 switch {
469 case gen1 > gen2:
470 return 1
471 case gen1 < gen2:
472 return -1
473 case sha1 > sha2:
474 return 1
475 case sha1 < sha2:
476 return -1
477 }
478 return 0
479}
480
481// StripInternalProperties returns a copy of the given body with all internal underscore-prefixed keys removed, except _attachments and _deleted.
482func StripInternalProperties(b Body) (Body, bool) {

Callers 3

winningRevisionMethod · 0.85
TestRevTreeCompareRevIDsFunction · 0.85
DefaultConflictResolverFunction · 0.85

Calls 1

ParseRevIDFunction · 0.85

Tested by 1

TestRevTreeCompareRevIDsFunction · 0.68