Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) MockOnAllowRegister(handler func(ctx context.Context, email string) (allow bool, err error)) *Mock
- func (svc *Mock) MockOnRegistered(handler func(ctx context.Context, email string) (err error)) *Mock
- func (svc *Mock) MockRegistered(handler func(ctx context.Context) (emails []string, err error)) *Mock
- func (svc *Mock) OnAllowRegister(ctx context.Context, email string) (allow bool, err error)
- func (svc *Mock) OnRegistered(ctx context.Context, email string) (err error)
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) Registered(ctx context.Context) (emails []string, err error)
- type Service
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) OnAllowRegister(ctx context.Context, email string) (allow bool, err error)
- func (svc *Service) OnRegistered(ctx context.Context, email string) (err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Registered(ctx context.Context) (emails []string, err error)
- type ToDo
Constants ¶
const ( Hostname = eventsinkapi.Hostname Version = 260 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶ added in v1.22.0
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 (*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
OnAllowRegister executes the mock handler.
func (*Mock) OnRegistered ¶ added in v1.22.0
OnRegistered executes the mock handler.
func (*Mock) OnShutdown ¶ added in v1.22.0
OnShutdown is called when the microservice is shut down.
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 (*Service) OnAllowRegister ¶
OnAllowRegister blocks registrations from gmail and hotmail domains.
func (*Service) OnRegistered ¶
OnRegistered keeps track of registrations.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
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.