db

package
v0.0.0-...-93140eb Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*bolt.DB
}

DB wraps BoltDB and handles storing/retrieving data

func (*DB) DeleteItem

func (db *DB) DeleteItem(id string) error

DeleteItem delete the item with `id` from the database

func (*DB) DoesItemExist

func (db *DB) DoesItemExist(code string) bool

DoesItemExist returns true if an item with `code` exists. Falase otherwise.

func (*DB) GetItem

func (db *DB) GetItem(code string) (*model.Item, error)

GetItem will retrieve an item from the database, given it's unique Code

func (*DB) GetItems

func (db *DB) GetItems() ([]*model.Item, error)

GetItems returns all items, yes, all of them. TODO: Add pagination

func (*DB) Open

func (db *DB) Open(name string) error

Open will open a new Bolt database and create the necessary buckets for using it elsewhere in Fire Dragon.

func (*DB) SaveItem

func (db *DB) SaveItem(item *model.Item) (*model.Item, error)

SaveItem will save the item, if the item has no code yet, it will be automatically assigned one. If a code is provided and it already exists, an error will be returned.

Jump to

Keyboard shortcuts

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