internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MainBucket ...
	MainBucket = []byte("users_main")
	// ErrEmptyID is returned if Get is called without an ID set.
	ErrEmptyID = errors.New("id cannot be empty")
)
View Source
var ErrNotImplemented = errors.New("not implemented")

ErrNotImplemented is returned if Apply is attempted on an internal event type.

View Source
var SnapshotBucket = []byte("users_snapshots")

SnapshotBucket ...

Functions

func Get

func Get(id string, _db *bolt.DB) (users.User, error)

Get ...

func New

func New(file string, opts *bolt.Options) (*bolt.DB, error)

New creates a new bolt database with the provided config.

Types

type Event

type Event interface {
	Apply(ctx context.Context, _db *bolt.DB) (users.User, error)
}

Event represents a database event.

func NewCreateEvent

func NewCreateEvent(u users.User) (Event, error)

NewCreateEvent ...

func NewDeleteEvent

func NewDeleteEvent(u users.User, v uint32) (Event, error)

NewDeleteEvent ...

func NewUpdateEvent

func NewUpdateEvent(u users.User, v uint32) (Event, error)

NewUpdateEvent ...

type Snapshot

type Snapshot struct {
	ID      string
	User    users.User
	Version uint32
}

Snapshot represents a snapshot of a value in a database.

func GetSnap

func GetSnap(id []byte, _db *bolt.DB) (*Snapshot, error)

GetSnap ...

Jump to

Keyboard shortcuts

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