application

package
v0.0.0-...-0a0b1f3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package application contains the application logic of the bookInfo management system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookInfoRepository

type BookInfoRepository interface {
	List(ctx context.Context) ([]domain.BookInfo, error)
	Get(ctx context.Context, ISBN string) (domain.BookInfo, error)
}

BookInfoRepository is the interface that we expect to be fulfilled to be used as a backend for BookInfo Service

type BookInfoService

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

BookInfoService represents the struct which contains a BookInfoRepository and exports methods to access the data

func NewBookInfoService

func NewBookInfoService(dr BookInfoRepository) BookInfoService

NewBookInfoService creates a new BookInfoService instance and sets its repository

func (BookInfoService) Get

func (ps BookInfoService) Get(ctx context.Context, isbn string) (domain.BookInfo, error)

Get selects the bookInfo from the included repository with the given unique identifier, and returns it Returns an error if the repository returns one

func (BookInfoService) List

func (ps BookInfoService) List(ctx context.Context) ([]domain.BookInfo, error)

List loads all the data from the included repository from the given space and returns them Returns an error if the repository returns one

type ErrorCannotFindBook

type ErrorCannotFindBook struct {
}

ErrorCannotFindBook is used when the Book with the given ISBN cannot be found on the underlying data source

func (*ErrorCannotFindBook) Error

func (e *ErrorCannotFindBook) Error() string

type ErrorCannotFindBooks

type ErrorCannotFindBooks struct{}

ErrorCannotFindBooks is used when no Book data cannot be retrieved on the underlying data source

func (*ErrorCannotFindBooks) Error

func (e *ErrorCannotFindBooks) Error() string

type ErrorParsePayload

type ErrorParsePayload struct{}

ErrorParsePayload is used when the payload is cannot be parsed by the communications package

func (*ErrorParsePayload) Error

func (e *ErrorParsePayload) Error() string

type ErrorPayloadMissing

type ErrorPayloadMissing struct{}

ErrorPayloadMissing is used when the communication package expects a payload and there is none

func (*ErrorPayloadMissing) Error

func (e *ErrorPayloadMissing) Error() string

type ErrorReadPayload

type ErrorReadPayload struct{}

ErrorReadPayload is used when the payload is cannot be read by the communications package

func (*ErrorReadPayload) Error

func (e *ErrorReadPayload) Error() string

type HealthRepository

type HealthRepository interface {
	Ready() bool
}

HealthRepository is the interface to interact with database

type HealthService

type HealthService struct {
	HealthRepository HealthRepository
}

HealthService is the struct to let outer layers to interact to the health applicatopn

func NewHealthService

func NewHealthService(hr HealthRepository) HealthService

NewHealthService creates a new HealthService instance and sets its repository

func (HealthService) Ready

func (hs HealthService) Ready() bool

Ready returns true if underlying reposiroty and its connection is up and running, false otherwise

Jump to

Keyboard shortcuts

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