dbclient

package
v0.0.0-...-4a54890 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltClient

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

BoltClient is the real implementation

func (*BoltClient) Check

func (bc *BoltClient) Check() bool

Check is a naive healthcheck, just makes sure the DB connection has been initialized.

func (*BoltClient) OpenBoltDb

func (bc *BoltClient) OpenBoltDb()

OpenBoltDb tries to open a hard-coded make-believe database.

func (*BoltClient) QueryAccount

func (bc *BoltClient) QueryAccount(ctx context.Context, accountID string) (model.Account, error)

QueryAccount lets us query an account object.

func (*BoltClient) Seed

func (bc *BoltClient) Seed()

Seed can be used to seed some sample accounts

type IBoltClient

type IBoltClient interface {
	OpenBoltDb()
	QueryAccount(ctx context.Context, accountID string) (model.Account, error)
	Seed()
	Check() bool
}

IBoltClient defines a simple little interface for interacting with a BoltDB

type MockBoltClient

type MockBoltClient struct {
	mock.Mock
}

MockBoltClient is a mock implementation of a datastore client for testing purposes

func (*MockBoltClient) Check

func (m *MockBoltClient) Check() bool

Check mock

func (*MockBoltClient) OpenBoltDb

func (m *MockBoltClient) OpenBoltDb()

OpenBoltDb mock

func (*MockBoltClient) QueryAccount

func (m *MockBoltClient) QueryAccount(ctx context.Context, accountID string) (model.Account, error)

QueryAccount mock

func (*MockBoltClient) Seed

func (m *MockBoltClient) Seed()

Seed mock

Jump to

Keyboard shortcuts

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