bolt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DATA_BUCKET = "data"
View Source
const FILES_BUCKET = "files"
View Source
const PAGE_BUCKET = "pages"
View Source
const ROUTE_BUCKET = "routes"
View Source
const USER_BUCKET = "users"

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltConfig

type BoltConfig struct {
	Bolt struct {
		Path string `json:"path"`
	} `json:"bolt"`
}

type ErrNoKey

type ErrNoKey string

ErrNoKey is a helper to create key not found errors.

func (ErrNoKey) Error

func (e ErrNoKey) Error() string

type Module

type Module struct {
	Bolt         *bolt.DB
	Backend      *db.Module
	ConfigModule *config.Module
	Logger       *logger.Module
	// contains filtered or unexported fields
}

Module bolt provides methods for writing and retrieving data from a bolt database.

func (*Module) Backup

func (m *Module) Backup(w io.Writer) error

Backup writes the entire database to w.

func (*Module) BackupToFile

func (m *Module) BackupToFile(path string) error

BackupToFile writes the entire database to the file at path.

func (*Module) Debug

func (m *Module) Debug(w io.Writer) error

Debug prints out all data in the database. Does not deserialize saved protos.

func (*Module) DeleteData added in v0.2.0

func (m *Module) DeleteData(data *models.Data) error

DeleteData deletes a data from the DB (but not any related pages).

func (*Module) DeleteFile added in v0.3.0

func (m *Module) DeleteFile(file *models.File) error

DeleteFile deletes a file from the DB (but not from the store).

func (*Module) DeletePage

func (m *Module) DeletePage(page *models.Page) error

DeletePage deletes the page and (note!) also deletes related routes.

func (*Module) DeleteRoute

func (m *Module) DeleteRoute(route *models.Route) error

DeleteRoute deletes a route from the DB (but not any related pages).

func (*Module) Get

func (m *Module) Get(bucket, key string, pb proto.Message) error

Get is a generic method of getting a proto from the bolt database.

func (*Module) GetData added in v0.2.0

func (m *Module) GetData(key string) (*models.Data, error)

GetData fetches a data from the DB by key

func (*Module) GetFile added in v0.3.0

func (m *Module) GetFile(uuid string) (*models.File, error)

GetFile fetches a file from the DB by key

func (*Module) GetFileByName added in v0.3.0

func (m *Module) GetFileByName(name string) (*models.File, error)

GetFileByName fetches a file from the DB by name

func (*Module) GetPage

func (m *Module) GetPage(uuid string) (*models.Page, error)

GetPage returns a page from the database

func (*Module) GetRoute

func (m *Module) GetRoute(uuid string) (*models.Route, error)

GetRoute fetches a route from the DB by UUID

func (*Module) GetUser

func (m *Module) GetUser(uuid string) (*models.User, error)

func (*Module) GetUserByEmail

func (m *Module) GetUserByEmail(email string) (*models.User, error)

func (*Module) GetUserByToken

func (m *Module) GetUserByToken(token string) (*models.User, error)

func (*Module) Init

func (m *Module) Init(c *service.Config)

Init implements service.Init

func (*Module) ListData added in v0.2.0

func (m *Module) ListData() ([]*models.Data, error)

ListData returns all data stored in the DB (unsorted)

func (*Module) ListFiles added in v0.3.0

func (m *Module) ListFiles() ([]*models.File, error)

ListFiles returns all files recorded in the DB (unsorted)

func (*Module) ListPages

func (m *Module) ListPages(opts *api.ListPageRequest) ([]*models.Page, error)

ListPages lists all the pages stored in the DB (unsorted), without contents

func (*Module) ListRoutes

func (m *Module) ListRoutes(opts *api.ListRouteRequest) ([]*models.Route, error)

ListRoutes returns all routes stored in the DB (unsorted)

func (*Module) ListUsers added in v0.3.0

func (m *Module) ListUsers() ([]*models.User, error)

func (*Module) Update

func (m *Module) Update(bucket string, pb db.AddressableProto) error

Update is a generic way of updating AddressableProto data in the bolt database.

func (*Module) UpdateData added in v0.2.0

func (m *Module) UpdateData(data *models.Data) error

func (*Module) UpdateDataBatch added in v0.2.0

func (m *Module) UpdateDataBatch(data []*models.Data) error

func (*Module) UpdateFile added in v0.3.0

func (m *Module) UpdateFile(file *models.File) error

UpdateFile updates (or creates if necessary) an existing file.

func (*Module) UpdatePage

func (m *Module) UpdatePage(page *models.Page) error

UpdatePage updates (creating if necessary) a new page. New pages and new content blocks will be assigned UUIDs

func (*Module) UpdateRoute

func (m *Module) UpdateRoute(route *models.Route) error

UpdateRoute updates (or creates if necessary) an existing route. The route uuid is set if it is blank.

func (*Module) UpdateUser

func (m *Module) UpdateUser(user *models.User) error

Jump to

Keyboard shortcuts

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