ticketsvc

package module
v0.0.0-...-582566e Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingIds = errors.New("missing ids")
	ErrParsingIds = errors.New("error parsing ids, should be ints")
)

Functions

func MakeGetEndpoint

func MakeGetEndpoint(svc Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(e EndpointSet, logger log.Logger) http.Handler

func MakeIncrementEndpoint

func MakeIncrementEndpoint(svc Service) endpoint.Endpoint

func MakeSetEndpoint

func MakeSetEndpoint(svc Service) endpoint.Endpoint

Types

type EndpointSet

type EndpointSet struct {
	GetEndpoint       endpoint.Endpoint
	SetEndpoint       endpoint.Endpoint
	IncrementEndpoint endpoint.Endpoint
}

func MakeClientEndpoints

func MakeClientEndpoints(instance string) (EndpointSet, error)

func MakeServerEndpoints

func MakeServerEndpoints(svc Service) EndpointSet

func (*EndpointSet) Get

func (e *EndpointSet) Get(ctx context.Context, ids ...int) ([]Tickets, error)

func (*EndpointSet) Increment

func (e *EndpointSet) Increment(ctx context.Context, ids ...int) ([]Tickets, error)

func (*EndpointSet) Set

func (e *EndpointSet) Set(ctx context.Context, tickets ...Tickets) ([]Tickets, error)

type Service

type Service interface {
	Get(ctx context.Context, ids ...int) ([]Tickets, error)
	Set(ctx context.Context, tickets ...Tickets) ([]Tickets, error)
	Increment(ctx context.Context, ids ...int) ([]Tickets, error)
}

func NewService

func NewService(logger log.Logger) Service

type ServiceMiddleware

type ServiceMiddleware func(Service) Service

func LoggingMiddleware

func LoggingMiddleware(logger log.Logger) ServiceMiddleware

type Tickets

type Tickets struct {
	Id      int `json:"id"`
	Tickets int `json:"tickets"`
}

func (Tickets) String

func (t Tickets) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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