database

package
v2.0.0-beta+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2016 License: GPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	*bolt.DB
}

Database represents a Bolt-backed data store

func Open

func Open(path string) (db Database, err error)

Open initializes or opens a database from a defined directory

func (*Database) AddUser

func (db *Database) AddUser(pubkey *key.Public) (id uint64, err error)

AddUser inserts a new user into the UserBucket with public key and ID (used as seed for lease).

func (*Database) AdminHash

func (db *Database) AdminHash() (hash string, err error)

AdminHash retrieves the password hash for administrator

func (*Database) DelUser

func (db *Database) DelUser(identifier interface{}) (err error)

DelUser removes a registered user using the pubkey as identifier.

func (*Database) GetID

func (db *Database) GetID(pubkey *key.Public) (id uint64, err error)

GetID returns the ID for a registered user.

func (*Database) SetAdmin

func (db *Database) SetAdmin(hash string) (err error)

SetAdmin sets the hashed password for the administrator

func (*Database) Update

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

Update wrapps bolt.DB.Update

func (*Database) View

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

View wrapps bolt.DB.View

type Tx

type Tx struct {
	*bolt.Tx
}

Tx represents a Bolt transaction

Jump to

Keyboard shortcuts

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