MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / GetUint64

Method GetUint64

lib/datastore/boltdb.go:231–246  ·  view source on GitHub ↗
(key []byte)

Source from the content-addressed store, hash-verified

229}
230
231func (ds *BoltDbStore) GetUint64(key []byte) (uint64, error) {
232 if len(key) == 0 {
233 return 0, _const.ErrKeyIsEmpty
234 }
235 tx, err := ds.conn.Begin(false) // Start a read-only transaction
236 if err != nil {
237 return 0, err
238 }
239 defer check(tx.Rollback)
240 bucket := tx.Bucket(bucketStable)
241 val := bucket.Get(key)
242 if val == nil {
243 return 0, _const.ErrKeyNotFound
244 }
245 return bytesToUint64(val), nil
246}
247
248// uint64ToBytes is a helper function that converts an uint64 to a byte slice
249func uint64ToBytes(val uint64) []byte {

Callers

nothing calls this directly

Calls 3

checkFunction · 0.85
bytesToUint64Function · 0.85
GetMethod · 0.65

Tested by

no test coverage detected