inmem

package
v0.0.0-...-1bf65b7 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package inmem provides in-memory repository, used for testing purposes

Package inmem provides in-memory repository, used for testing purposes

Package inmem provides in-memory repository, used for testing purposes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockAccountsRepository

func NewMockAccountsRepository() coins.AccountRepository

NewMockAccountsRepository creates new MockAccountsRepository and fills it with test data

func NewMockPaymentsRepository

func NewMockPaymentsRepository() coins.PaymentRepository

NewMockPaymentsRepository creates new empty NewMockPaymentsRepository

Types

type Conn

type Conn struct{}

Conn is a mock type implementing TxStarter interface

func (*Conn) Begin

func (c *Conn) Begin() (coins.Transaction, error)

Begin starts a new mock transaction

type MockAccountsRepository

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

MockAccountsRepository is a in-memory storage for user accounts

func (*MockAccountsRepository) Commit

func (r *MockAccountsRepository) Commit() error

Commit does nothing ;)

func (*MockAccountsRepository) FindAll

func (r *MockAccountsRepository) FindAll() ([]*coins.Account, error)

FindAll returns all accounts from MockAccountsRepository

func (*MockAccountsRepository) FindForUpdate

FindForUpdate finds an account in MockAccountsRepository by it's ID

func (*MockAccountsRepository) Rollback

func (r *MockAccountsRepository) Rollback() error

Rollback does nothing ;)

func (*MockAccountsRepository) Update

Update updates account in MockAccountsRepository by it's ID

type MockPaymentsRepository

type MockPaymentsRepository struct {
	Payments []*coins.Payment
}

MockPaymentsRepository is a in-memory storage for user payments

func (*MockPaymentsRepository) FindAll

func (r *MockPaymentsRepository) FindAll() ([]*coins.Payment, error)

FindAll returns all payments MockPaymentsRepository

func (*MockPaymentsRepository) Insert

func (r *MockPaymentsRepository) Insert(_ coins.Transaction, payment *coins.Payment) error

Insert inserts new payment in MockPaymentsRepository

type Trx

type Trx struct{}

Trx is a mock type implementing Transaction interface

func (*Trx) Commit

func (t *Trx) Commit() error

Commit commits transaction

func (*Trx) Rollback

func (t *Trx) Rollback() error

Rollback rolls transaction back

Jump to

Keyboard shortcuts

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