mirror of
https://github.com/talent-plan/tinykv.git
synced 2025-01-14 06:10:10 +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) {
|
func GetCF(db *badger.DB, cf string, key []byte) (val []byte, err error) {
|
||||||
err = db.View(func(txn *badger.Txn) error {
|
err = db.View(func(txn *badger.Txn) error {
|
||||||
item, err := txn.Get(KeyWithCF(cf, key))
|
val, err = GetCFFromTxn(txn, cf, key)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
val, err = item.ValueCopy(val)
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user