badger_wrapper

package module
v0.0.0-...-67a82d5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 6 Imported by: 0

README

badger_wrapper

badger wrapper service

Documentation

Overview

Package badger_wrapper is wrapper at https://godoc.org/github.com/dgraph-io/badger to easy use.

If "namespace" or the "key" does not exist in the provided base, an error
is returned, otherwise the retrieved value/s.
If the key/value pair cannot be saved, an error is returned.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	// Get attempts to get a value for a given key
	Get(namespace, key string) (value []byte, err error)
	// Set attempts to store a value for a given key
	Set(namespace, key string, value []byte) error
	// Has returns a boolean reflecting if the
	// database has a given key for a namespace or not.
	Has(namespace, key string) (bool, error)
	// Close closes the connection to the underlying
	Close() error
}

func NewDB

func NewDB(ctx context.Context, dir string) (DB, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) Close

func (s *Service) Close() error

func (*Service) Get

func (s *Service) Get(namespace, key string) (value []byte, err error)

func (*Service) Has

func (s *Service) Has(namespace, key string) (ok bool, err error)

func (*Service) RunGC

func (s *Service) RunGC() error

RunGC triggers the garbage collection for the db backend database. It should be run in a goroutine.

func (*Service) Set

func (s *Service) Set(namespace, key string, value []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL