service

package
v0.0.0-...-ca40f45 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")

	ErrForbidden = errors.New("forbidden")

	ErrInvalidData = errors.New("invalid data")

	ErrInvalidPathParam = errors.New("invalid path param")

	ErrIdIncorrect = errors.New("id is not provided or incorrect ")
)

Functions

This section is empty.

Types

type InstrumentingMiddleware

type InstrumentingMiddleware struct {
	RequestCount   metrics.Counter
	RequestLatency metrics.Histogram
	CountResult    metrics.Histogram
	Next           Service
}

func (InstrumentingMiddleware) CheckHome

func (i InstrumentingMiddleware) CheckHome(ctx context.Context, id int64) (res *domain.HomeCrime, err error)

func (InstrumentingMiddleware) CreateCrime

func (i InstrumentingMiddleware) CreateCrime(ctx context.Context, crime *domain.Crime) (res *domain.Crime, err error)

func (InstrumentingMiddleware) CreateHome

func (i InstrumentingMiddleware) CreateHome(ctx context.Context, home *domain.Home) (res *domain.Home, err error)

func (InstrumentingMiddleware) DeleteCrime

func (i InstrumentingMiddleware) DeleteCrime(ctx context.Context, id int64) (err error)

func (InstrumentingMiddleware) DeleteHome

func (i InstrumentingMiddleware) DeleteHome(ctx context.Context, id int64) (err error)

func (InstrumentingMiddleware) GetCrime

func (i InstrumentingMiddleware) GetCrime(ctx context.Context, id int64) (res *domain.Crime, err error)

func (InstrumentingMiddleware) GetCrimes

func (i InstrumentingMiddleware) GetCrimes(ctx context.Context) (res *[]domain.Crime, err error)

func (InstrumentingMiddleware) GetHome

func (i InstrumentingMiddleware) GetHome(ctx context.Context, id int64) (res *domain.Home, err error)

func (InstrumentingMiddleware) UpdateCrime

func (i InstrumentingMiddleware) UpdateCrime(ctx context.Context, crime *domain.Crime) (res *domain.Crime, err error)

type LoggingMiddleWare

type LoggingMiddleWare struct {
	Logger log.Logger
	Next   Service
}

func (LoggingMiddleWare) CheckHome

func (m LoggingMiddleWare) CheckHome(ctx context.Context, id int64) (home *domain.HomeCrime, err error)

func (LoggingMiddleWare) CreateCrime

func (m LoggingMiddleWare) CreateCrime(ctx context.Context, crime *domain.Crime) (res *domain.Crime, err error)

func (LoggingMiddleWare) CreateHome

func (m LoggingMiddleWare) CreateHome(ctx context.Context, req *domain.Home) (home *domain.Home, err error)

func (LoggingMiddleWare) DeleteCrime

func (m LoggingMiddleWare) DeleteCrime(ctx context.Context, id int64) (err error)

func (LoggingMiddleWare) DeleteHome

func (m LoggingMiddleWare) DeleteHome(ctx context.Context, id int64) (err error)

func (LoggingMiddleWare) GetCrime

func (m LoggingMiddleWare) GetCrime(ctx context.Context, id int64) (res *domain.Crime, err error)

func (LoggingMiddleWare) GetCrimes

func (m LoggingMiddleWare) GetCrimes(ctx context.Context) (res *[]domain.Crime, err error)

func (LoggingMiddleWare) GetHome

func (m LoggingMiddleWare) GetHome(ctx context.Context, id int64) (home *domain.Home, err error)

func (LoggingMiddleWare) UpdateCrime

func (m LoggingMiddleWare) UpdateCrime(ctx context.Context, crime *domain.Crime) (res *domain.Crime, err error)

type Service

type Service interface {
	GetCrimes(ctx context.Context) (*[]domain.Crime, error)
	GetCrime(ctx context.Context, id int64) (*domain.Crime, error)
	CreateCrime(ctx context.Context, crime *domain.Crime) (*domain.Crime, error)
	UpdateCrime(ctx context.Context, crime *domain.Crime) (*domain.Crime, error)
	DeleteCrime(ctx context.Context, id int64) error

	CreateHome(ctx context.Context, home *domain.Home) (*domain.Home, error)
	GetHome(ctx context.Context, id int64) (*domain.Home, error)
	DeleteHome(ctx context.Context, id int64) error
	CheckHome(ctx context.Context, id int64) (*domain.HomeCrime, error)
}

func NewService

func NewService(store store.Repository, logger log.Logger) Service

Jump to

Keyboard shortcuts

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