intermediate

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package intermediate serves as the foundation of the eventsink.example microservice.

The event sink microservice handles events that are fired by the event source microservice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate

type Intermediate struct {
	*connector.Connector
	// contains filtered or unexported fields
}

Intermediate extends and customizes the generic base connector. Code generated microservices then extend the intermediate.

func NewService

func NewService(impl ToDo, version int) *Intermediate

NewService creates a new intermediate service.

type Mock

type Mock struct {
	*Intermediate
	// contains filtered or unexported fields
}

Mock is a mockable version of the eventsink.example microservice, allowing functions, event sinks and web handlers to be mocked.

func NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) MockOnAllowRegister

func (svc *Mock) MockOnAllowRegister(handler func(ctx context.Context, email string) (allow bool, err error)) *Mock

MockOnAllowRegister sets up a mock handler for the OnAllowRegister endpoint.

func (*Mock) MockOnRegistered

func (svc *Mock) MockOnRegistered(handler func(ctx context.Context, email string) (err error)) *Mock

MockOnRegistered sets up a mock handler for the OnRegistered endpoint.

func (*Mock) MockRegistered

func (svc *Mock) MockRegistered(handler func(ctx context.Context) (emails []string, err error)) *Mock

MockRegistered sets up a mock handler for the Registered endpoint.

func (*Mock) OnAllowRegister

func (svc *Mock) OnAllowRegister(ctx context.Context, email string) (allow bool, err error)

OnAllowRegister runs the mock handler set by MockOnAllowRegister.

func (*Mock) OnRegistered

func (svc *Mock) OnRegistered(ctx context.Context, email string) (err error)

OnRegistered runs the mock handler set by MockOnRegistered.

func (*Mock) OnShutdown

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is a no op.

func (*Mock) OnStartup

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup makes sure that the mock is not executed in a non-dev environment.

func (*Mock) Registered

func (svc *Mock) Registered(ctx context.Context) (emails []string, err error)

Registered runs the mock handler set by MockRegistered.

type ToDo

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	Registered(ctx context.Context) (emails []string, err error)
	OnAllowRegister(ctx context.Context, email string) (allow bool, err error)
	OnRegistered(ctx context.Context, email string) (err error)
}

ToDo defines the interface that the microservice must implement. The intermediate delegates handling to this interface.

Jump to

Keyboard shortcuts

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