reuse GetCFFromTxn (#136)

Co-authored-by: Connor <zbk602423539@gmail.com>
This commit is contained in:
Rich 2020-03-24 17:53:45 +08:00 committed by Connor
parent ef92f265f3
commit dcc172a122

View File

@ -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