Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrEncryptionKeyNotProvided = errors.New("encryption key not provided")
)
Functions ¶
This section is empty.
Types ¶
type BadgerKVStore ¶
BadgerKVStore is an implementation of the KVStore interface using BadgerDB.
func NewBadgerKVStore ¶
func NewBadgerKVStore(dbPath string, encryptionKey []byte) (*BadgerKVStore, error)
NewBadgerKVStore creates a new BadgerKVStore instance.
func (*BadgerKVStore) Delete ¶
func (b *BadgerKVStore) Delete(key string) error
Delete removes a key-value pair from BadgerDB.
func (*BadgerKVStore) Get ¶
func (b *BadgerKVStore) Get(key string) ([]byte, error)
Get retrieves the value associated with a key from BadgerDB.
func (*BadgerKVStore) Keys ¶
func (b *BadgerKVStore) Keys() ([]string, error)
type KVStore ¶
type KVStore interface {
// Put stores a key-value pair in the store.
Put(key string, value []byte) error
// Get retrieves the value associated with a key. If the key is not found, it returns an empty slice.
Get(key string) ([]byte, error)
// Delete removes a key-value pair from the store.
Delete(key string) error
// Close closes the key-value store.
Close() error
}
KVStore defines the interface for a key-value store.
Click to show internal directories.
Click to hide internal directories.