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

Method SetUint64

lib/datastore/boltdb.go:214–229  ·  view source on GitHub ↗
(key []byte, val uint64)

Source from the content-addressed store, hash-verified

212}
213
214func (ds *BoltDbStore) SetUint64(key []byte, val uint64) error {
215 if len(key) == 0 {
216 return _const.ErrKeyIsEmpty
217 }
218 tx, err := ds.conn.Begin(true) // Start a read-write transaction
219 if err != nil {
220 return err
221 }
222 defer check(tx.Rollback)
223 bucket := tx.Bucket(bucketStable)
224 err = bucket.Put(key, uint64ToBytes(val))
225 if err != nil {
226 return err
227 }
228 return tx.Commit()
229}
230
231func (ds *BoltDbStore) GetUint64(key []byte) (uint64, error) {
232 if len(key) == 0 {

Callers

nothing calls this directly

Calls 4

checkFunction · 0.85
uint64ToBytesFunction · 0.85
CommitMethod · 0.80
PutMethod · 0.65

Tested by

no test coverage detected