clessy-ng/utils/kv.go
Hamcha 42de49b13d
Some checks failed
continuous-integration/drone/push Build is failing
Use db not files!
2022-03-25 20:06:13 +01:00

15 lines
317 B
Go

package utils
import (
"github.com/cockroachdb/pebble"
jsoniter "github.com/json-iterator/go"
)
func ReadJSON(db *pebble.DB, key string, dst interface{}) error {
data, closer, err := db.Get([]byte(key))
if err != nil {
return err
}
defer closer.Close()
return jsoniter.ConfigFastest.Unmarshal(data, dst)
}