slap

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 10 Imported by: 0

README

slap

Badger DB wrapper

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidParameter ...
	ErrInvalidParameter = errors.New("invalid parameter")
	// ErrTypeConversion ...
	ErrTypeConversion = errors.New("type conversion")
	// ErrNoRecord ...
	ErrNoRecord = errors.New("record does not exist")
	// ErrReservedWord ...
	ErrReservedWord = errors.New("reserved identifier used")
	// ErrNoPrimaryID ...
	ErrNoPrimaryID = errors.New("primary ID field does not exist")
	// ErrMalformedKey ...
	ErrMalformedKey = errors.New("malformed key or zero key fields")
)

Functions

This section is empty.

Types

type DB

type DB struct {
	*badger.DB
}

DB ...

type Store added in v0.2.0

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

Store ...

func New

func New(path, schema string) *Store

New ...

func (*Store) Create added in v0.2.0

func (p *Store) Create(data interface{}) ([]string, error)

Create accepts struct or slice of struct pointers Returns slice of record IDs saved

func (*Store) Delete added in v0.2.0

func (p *Store) Delete(data interface{}, ids ...string) error

Delete removes one or many records with given IDs Accepts a struct and variadic IDs

func (*Store) Read added in v0.2.0

func (p *Store) Read(data interface{}, ftr []string, ids ...string) ([]interface{}, error)

Read retrieves one or many records with given IDs Returns slice of interfaces

func (*Store) Select added in v0.2.0

func (p *Store) Select(x interface{}, ftr []string) ([]interface{}, error)

Select retrieves records ANDing non zero values Returns slice of interfaces

func (*Store) Take added in v0.2.0

func (p *Store) Take(table interface{}, filter []string, seek string, limit int) ([]interface{}, error)

Take ...

func (*Store) Tidy added in v0.2.0

func (p *Store) Tidy()

Tidy ...

func (*Store) Update added in v0.2.0

func (p *Store) Update(data interface{}, ids ...string) error

Update mofifies records with given IDs Non zero values are updated

func (*Store) WithDB added in v0.2.0

func (p *Store) WithDB(f func(*badger.DB) error) (err error)

WithDB ...

Jump to

Keyboard shortcuts

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