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)
| 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. |
| 326 | func 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 | |
| 334 | func IsCasMismatch(err error) bool { |
| 335 | if err == nil { |