data

package
v0.0.0-...-967dab9 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalQuery

func EvalQuery(q interface{}, src *Collection, result *map[int]struct{}) (err error)

Types

type Collection

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

func (*Collection) Delete

func (c *Collection) Delete(id int)

func (*Collection) ForEachDoc

func (c *Collection) ForEachDoc(fn func(id int, doc []byte) (moveOn bool))

func (*Collection) Index

func (c *Collection) Index(cols []string) error

func (*Collection) Insert

func (c *Collection) Insert(doc map[string]interface{}) (int, error)

func (*Collection) Read

func (c *Collection) Read(id int) (doc map[string]interface{}, err error)

func (*Collection) Update

func (c *Collection) Update(id int, doc map[string]interface{}) error

type DB

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

func NewDatabaseConnection

func NewDatabaseConnection(rootPath string, l *log.Logger) (database *DB)

func OpenDB

func OpenDB(rootPath string, l *log.Logger) (*DB, error)

func (*DB) Create

func (d *DB) Create(name string) error

func (*DB) Use

func (d *DB) Use(name string) *Collection

type GenericModel

type GenericModel map[string]interface{}

type GenericRepository

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

func NewGenericRepository

func NewGenericRepository(database *DB, coll string) *GenericRepository

func (*GenericRepository) Delete

func (repo *GenericRepository) Delete(id int)

func (*GenericRepository) Fetch

func (repo *GenericRepository) Fetch(id int) GenericModel

func (*GenericRepository) FetchAll

func (repo *GenericRepository) FetchAll() []GenericModel

func (*GenericRepository) Index

func (repo *GenericRepository) Index(cols []string)

func (*GenericRepository) Query

func (repo *GenericRepository) Query(query interface{}) []GenericModel

func (*GenericRepository) Save

func (repo *GenericRepository) Save(generic GenericModel)

Jump to

Keyboard shortcuts

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