order

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

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByCreatedAt

type ByCreatedAt []*entity.Order

ByCreatedAt struct used by Sort function

func (ByCreatedAt) Len

func (a ByCreatedAt) Len() int

func (ByCreatedAt) Less

func (a ByCreatedAt) Less(i, j int) bool

func (ByCreatedAt) Swap

func (a ByCreatedAt) Swap(i, j int)

type InMem

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

InMem in memory repo

func (*InMem) Create

func (r *InMem) Create(e *entity.Order) (*entity.Order, error)

Create an Order

func (*InMem) Delete

func (r *InMem) Delete(id entity.ID) error

Delete order

func (*InMem) Get

func (r *InMem) Get(id entity.ID) (*entity.Order, error)

Get an order

func (*InMem) List

func (r *InMem) List() ([]*entity.Order, error)

List orders

type Reader

type Reader interface {
	Get(id entity.ID) (*entity.Order, error)
	List() ([]*entity.Order, error)
}

Reader interface

type Repository

type Repository interface {
	Reader
	Writer
}

Repository interface

type Service

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

Service interface

func NewService

func NewService(r Repository) *Service

NewService create new use case

func (*Service) CreateOrder

func (s *Service) CreateOrder(customer string, pizzas []entity.Pizza) (*entity.Order, error)

CreateOrder Create an Order

func (*Service) DeleteOrder

func (s *Service) DeleteOrder(id entity.ID) error

DeleteOrder Delete an Order

func (*Service) GetOrder

func (s *Service) GetOrder(id entity.ID) (*entity.Order, error)

GetOrder retrieves an Order given the ID

func (*Service) ListOrders

func (s *Service) ListOrders() ([]*entity.Order, error)

ListOrders List Orders

type UseCase

type UseCase interface {
	GetOrder(id entity.ID) (*entity.Order, error)
	ListOrders() ([]*entity.Order, error)
	CreateOrder(customer string, pizza []entity.Pizza) (*entity.Order, error)
	DeleteOrder(entity.ID) error
}

UseCase interface

type Writer

type Writer interface {
	Create(e *entity.Order) (*entity.Order, error)
	Delete(id entity.ID) error
}

Writer Order writer

Jump to

Keyboard shortcuts

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