service

package
v0.0.0-...-f78582e Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer func(msg Message)

type ConsumerService

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

func NewConsumerService

func NewConsumerService(repo data.Repository, nc Subscriber, logger *log.Logger) *ConsumerService

func (ConsumerService) GetCoffees

func (c ConsumerService) GetCoffees(msg Message)

func (ConsumerService) RegisterConsumer

func (c ConsumerService) RegisterConsumer(topic string, consumer Consumer)

type HealthService

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

HealthService is a HTTP Consumer for health checking

func NewHealth

func NewHealth(l *log.Logger) *HealthService

NewHealth creates a new Health handler

func (*HealthService) ServeHTTP

func (h *HealthService) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the handler interface

type Message

type Message interface {
	Respond(data []byte) error
}

type ProductService

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

ProductService defines the operations the service supports

func NewCoffeeService

func NewCoffeeService(repo data.Repository, nc events.Publisher, logger *log.Logger) *ProductService

NewCoffeeService creates a new instance of the coffee service

func (*ProductService) Add

Add adds a new coffee from the json body

func (*ProductService) Get

Get retrieves a coffee by id

func (*ProductService) List

List retrieves a list of coffees

func (*ProductService) RegisterRoutes

func (p *ProductService) RegisterRoutes(r *mux.Router)

type Subscriber

type Subscriber interface {
	SubscribeSync(subj string) (*nats.Subscription, error)
}

Jump to

Keyboard shortcuts

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