rest

package
v0.0.0-...-571a155 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	TransactionCreator TransactionCreator
	TransactionLister  TransactionLister
}

API holds all use cases.

func NewAPI

func NewAPI(creator TransactionCreator, lister TransactionLister) *API

NewAPI initialize the API.

func (*API) HandleCreateTransaction

func (api *API) HandleCreateTransaction() http.HandlerFunc

HandleCreateTransaction receives the request and call the use case to create a transaction.

func (*API) HandleListTransaction

func (api *API) HandleListTransaction() http.HandlerFunc

HandleListTransaction receives the request and call the use case to list transactions.

func (*API) Routes

func (api *API) Routes() *chi.Mux

Routes assigns a path to a request handler.

type TransactionCreator

type TransactionCreator interface {
	Create(core.Transaction) (core.Transaction, error)
}

TransactionCreator represents a use case able to create a transaction.

type TransactionLister

type TransactionLister interface {
	List() ([]core.Transaction, error)
}

TransactionLister represents a use case able to list transactions.

Jump to

Keyboard shortcuts

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