db

package
v0.0.0-...-ec640b9 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPageNotFound = &Error{"page not found", nil}
	ErrNoPageName   = &Error{"no page name", nil}
)

Errors

Functions

This section is empty.

Types

type DB

type DB struct {
	*bolt.DB
}

DB represents a Bolt-backed data store.

func (*DB) Open

func (db *DB) Open(path string, mode os.FileMode) error

Open initializes and opens the database.

func (*DB) Update

func (db *DB) Update(fn func(*Tx) error) error

Update executes a function in the context of a writable transaction.

func (*DB) View

func (db *DB) View(fn func(*Tx) error) error

View executes a function in the context of a read-only transaction.

type Error

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

Error represents an error condition within the database.

func (*Error) Error

func (e *Error) Error() string

Error returns a string representation of the error.

type Page

type Page struct {
	Tx   *Tx
	Name []byte
	Text []byte
}

Page represents a Wiki page

func (*Page) Load

func (p *Page) Load() error

Load retrieves a page from the database.

func (*Page) Save

func (p *Page) Save() error

Save commits the Page to the database.

type Tx

type Tx struct {
	*bolt.Tx
}

Tx represents a BoltDB transaction

func (*Tx) Page

func (tx *Tx) Page(name []byte) (*Page, error)

Page retrieves a Page from the database with the given name.

Jump to

Keyboard shortcuts

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