eventsource

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = eventsourceapi.Hostname
	Version  = 270
)

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 microservice and the connector.

func NewIntermediate added in v1.22.0

func NewIntermediate(impl ToDo) *Intermediate

NewIntermediate creates a new intermediary for the microservice.

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) MockRegister added in v1.22.0

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

MockRegister sets up a mock handler for Register.

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) Register added in v1.22.0

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

Register executes the mock handler.

type Service

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

Service implements the eventsource.example microservice.

The event source microservice fires events that are caught by the event sink 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) 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) Register

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

Register attempts to register a new user.

type ToDo added in v1.22.0

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	Register(ctx context.Context, email string) (allowed bool, err error) // MARKER: Register
}

ToDo is the interface that must be implemented by the microservice.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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