mirror of
https://github.com/talent-plan/tinykv.git
synced 2024-12-27 05:10:19 +08:00
reuse GetCFFromTxn (#136)
Co-authored-by: Connor <zbk602423539@gmail.com>
This commit is contained in:
parent
ef92f265f3
commit
dcc172a122
@ -13,11 +13,7 @@ func KeyWithCF(cf string, key []byte) []byte {
|
||||
|
||||
func GetCF(db *badger.DB, cf string, key []byte) (val []byte, err error) {
|
||||
err = db.View(func(txn *badger.Txn) error {
|
||||
item, err := txn.Get(KeyWithCF(cf, key))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
val, err = item.ValueCopy(val)
|
||||
val, err = GetCFFromTxn(txn, cf, key)
|
||||
return err
|
||||
})
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user