badger

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badger

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

Badger is the storage driver to manage data using a local database (this configuration is not High Available)

func (Badger) Close

func (b Badger) Close() error

Close releases the resources associated with the Store.

func (Badger) Delete

func (b Badger) Delete(ctx context.Context, collection, id string) (ok bool, err error)

Delete removes the required ID on the dataset

func (Badger) Get

func (b Badger) Get(ctx context.Context, collection, id string, value interface{}) (err error)

Get retrieves a value from the storage and unmarshals it to the required type

func (Badger) GetAll

func (b Badger) GetAll(ctx context.Context, collection string) (values []map[string]interface{}, err error)

GetAll retrieves all the items for the required dataset

func (Badger) Ping

func (b Badger) Ping(ctx context.Context) error

Ping returns nil (TODO: review)

func (Badger) Set

func (b Badger) Set(ctx context.Context, collection, id string, value interface{}) (err error)

Set inserts/updates a item in the dataset

type Driver

type Driver struct {
}

Driver initializes a Badger struct and returns it

func (Driver) Open

func (f Driver) Open(ctx context.Context, connection string) (store.Store, error)

Open creates the Badger struct, configures and returns it

connection = directory where the database will be stored

Jump to

Keyboard shortcuts

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