db

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFilemode = 0666
View Source
const DefaultStartupTimeout = time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

func NewDB(path string, filemode os.FileMode, boltOptions *bolt.Options, startupTimeout time.Duration, roots ...string) (*DB, error)

func NewDefaultDB

func NewDefaultDB(path string, roots ...string) (*DB, error)

func (*DB) Close

func (d *DB) Close()

func (*DB) Delete

func (d *DB) Delete(m Model, key string) error

func (*DB) Exists

func (d *DB) Exists(m Model, key string) bool

func (*DB) Find

func (d *DB) Find(m Model, key string) (Model, error)

func (*DB) Get

func (d *DB) Get(m Model, query Query) ([]Model, error)

func (*DB) Save

func (d *DB) Save(m Model) error

type Model

type Model interface {
	DBIndexes() (map[string]string, map[string]bool, map[string]int)
	DBRoot() string
	DBUnmarshal(data []byte) (Model, error)
	DBMarshal() ([]byte, error)
	DBKey() string
}

type NotFoundError

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

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Query

type Query struct {
	Strings map[string]string
	Bools   map[string]bool
	Ints    map[string]int
}

func Q

func Q() Query

func (Query) Bool

func (q Query) Bool(k string, v bool) Query

func (Query) Int

func (q Query) Int(k string, v int) Query

func (Query) String

func (q Query) String(k string, v string) Query

Jump to

Keyboard shortcuts

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