dbclient

package
v0.0.0-...-8d67cd6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GormClient

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

func NewGormClient

func NewGormClient(cfg *cmd.Config) *GormClient

func (*GormClient) Check

func (gc *GormClient) Check() bool

func (*GormClient) Close

func (gc *GormClient) Close()

func (*GormClient) GetRandomAccount

func (gc *GormClient) GetRandomAccount(ctx context.Context) (model.AccountData, error)

func (*GormClient) QueryAccount

func (gc *GormClient) QueryAccount(ctx context.Context, accountId string) (model.AccountData, error)

func (*GormClient) QueryAccountByNameWithCount

func (gc *GormClient) QueryAccountByNameWithCount(ctx context.Context, name string) ([]Pair, error)

func (*GormClient) SeedAccounts

func (gc *GormClient) SeedAccounts() error

func (*GormClient) SetupDB

func (gc *GormClient) SetupDB(addr string)

func (*GormClient) StoreAccount

func (gc *GormClient) StoreAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error)

StoreAccount uses ACID TX.

func (*GormClient) UpdateAccount

func (gc *GormClient) UpdateAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error)

UpdateAccount uses ACID TX.

type IGormClient

type IGormClient interface {
	UpdateAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error)
	StoreAccount(ctx context.Context, accountData model.AccountData) (model.AccountData, error)
	QueryAccount(ctx context.Context, accountId string) (model.AccountData, error)
	GetRandomAccount(ctx context.Context) (model.AccountData, error)
	QueryAccountByNameWithCount(ctx context.Context, name string) ([]Pair, error)
	SetupDB(addr string)
	SeedAccounts() error
	Check() bool
	Close()
}

IGormClient defines a number of operations we want to be able to perform vs an underlying data store.

type Pair

type Pair struct {
	Name  string
	Count uint8
}

Directories

Path Synopsis
Package mock_dbclient is a generated GoMock package.
Package mock_dbclient is a generated GoMock package.

Jump to

Keyboard shortcuts

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