account

package
v0.0.0-...-9d4beaf Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package account provides the use-case of accounts management. Used by views facing an administrator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHandler

func MakeHandler(s Service, logger kitlog.Logger) http.Handler

MakeHandler returns a handler for the account service.

Types

type Account

type Account struct {
	ID       wallet.AccountID `json:"id"`
	Balance  wallet.Money     `json:"balance"`
	Currency wallet.Currency  `json:"currency"`
}

Account is a read model for account views.

type ErrorResp

type ErrorResp struct {
	Error error `json:"error"`
}

func (*ErrorResp) MarshalJSON

func (r *ErrorResp) MarshalJSON() ([]byte, error)

func (*ErrorResp) StatusCode

func (r *ErrorResp) StatusCode() int

type Service

type Service interface {
	// List shows all available accounts
	List(ctx context.Context) ([]Account, error)

	// One shows accounts
	One(ctx context.Context, id wallet.AccountID) (Account, error)
}

Service provides account related methods.

func NewInstrumenting

func NewInstrumenting(counter metrics.Counter, latency metrics.Histogram, s Service) Service

NewInstrumenting returns an instance of an instrumenting Service.

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

NewLoggingService returns a new instance of a logging Service.

func NewService

func NewService(logger log.Logger, db orm.DB, accounts wallet.AccountRepository) Service

NewService service constructor

Jump to

Keyboard shortcuts

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