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

Function GetCounter

base/bucket.go:326–332  ·  view source on GitHub ↗

GetCounter returns a uint64 result for the given counter key. If the given key is not found in the bucket, this function returns a result of zero.

(datastore DataStore, k string)

Source from the content-addressed store, hash-verified

324// GetCounter returns a uint64 result for the given counter key.
325// If the given key is not found in the bucket, this function returns a result of zero.
326func GetCounter(datastore DataStore, k string) (result uint64, err error) {
327 _, err = datastore.Get(k, &result)
328 if IsDocNotFoundError(err) {
329 return 0, nil
330 }
331 return result, err
332}
333
334func IsCasMismatch(err error) bool {
335 if err == nil {

Callers 2

getSequenceMethod · 0.92
TestIncrCounterFunction · 0.85

Calls 2

IsDocNotFoundErrorFunction · 0.85
GetMethod · 0.45

Tested by 1

TestIncrCounterFunction · 0.68