(key []byte)
| 229 | } |
| 230 | |
| 231 | func (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 |
| 249 | func uint64ToBytes(val uint64) []byte { |
nothing calls this directly
no test coverage detected