eventsink

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = eventsinkapi.Hostname
	Version  = 260
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate added in v1.22.0

type Intermediate struct {
	*connector.Connector
	ToDo
}

Intermediate is the intermediary between the service implementation and the framework.

func NewIntermediate added in v1.22.0

func NewIntermediate(impl ToDo) *Intermediate

NewIntermediate creates a new Intermediate.

type Mock

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

Mock is a mockable version of the 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 added in v1.22.0

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

MockOnAllowRegister sets up a mock handler for OnAllowRegister.

func (*Mock) MockOnRegistered added in v1.22.0

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

MockOnRegistered sets up a mock handler for OnRegistered.

func (*Mock) MockRegistered added in v1.22.0

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

MockRegistered sets up a mock handler for Registered.

func (*Mock) OnAllowRegister added in v1.22.0

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

OnAllowRegister executes the mock handler.

func (*Mock) OnRegistered added in v1.22.0

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

OnRegistered executes the mock handler.

func (*Mock) OnShutdown added in v1.22.0

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

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup added in v1.22.0

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

OnStartup is called when the microservice is started up.

func (*Mock) Registered added in v1.22.0

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

Registered executes the mock handler.

type Service

type Service struct {
	*Intermediate // IMPORTANT: Do not remove
}

Service implements the eventsink.example microservice.

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

func NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) OnAllowRegister

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

OnAllowRegister blocks registrations from gmail and hotmail domains.

func (*Service) OnRegistered

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

OnRegistered keeps track of registrations.

func (*Service) OnShutdown

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

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

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

OnStartup is called when the microservice is started up.

func (*Service) Registered

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

Registered returns the list of registered users.

type ToDo added in v1.22.0

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

ToDo defines the interface of the microservice.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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