Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- type Hook
- func (c Hook) ForHost(host string) Hook
- func (c Hook) OnAllowRegister(handler func(ctx context.Context, email string) (allow bool, err error)) (unsub func() error, err error)
- func (c Hook) OnRegistered(handler func(ctx context.Context, email string) (err error)) (unsub func() error, err error)
- func (c Hook) WithOptions(opts ...sub.Option) Hook
- type MulticastClient
- type MulticastTrigger
- func (_c MulticastTrigger) ForHost(host string) MulticastTrigger
- func (_c MulticastTrigger) OnAllowRegister(ctx context.Context, email string) iter.Seq[*OnAllowRegisterResponse]
- func (_c MulticastTrigger) OnRegistered(ctx context.Context, email string) iter.Seq[*OnRegisteredResponse]
- func (_c MulticastTrigger) WithOptions(opts ...pub.Option) MulticastTrigger
- type OnAllowRegisterIn
- type OnAllowRegisterOut
- type OnAllowRegisterResponse
- type OnRegisteredIn
- type OnRegisteredOut
- type OnRegisteredResponse
- type RegisterIn
- type RegisterOut
- type RegisterResponse
Constants ¶
const Description = `The event source microservice fires events that are caught by the event sink microservice.`
Description is the human-readable summary of the microservice, surfaced in OpenAPI and discovery.
const Hostname = "eventsource.example"
Hostname is the default hostname of the microservice.
const Name = "EventSource"
Name is the decorative PascalCase name of the microservice.
const Version = 270
Version is a generation counter bumped on each regeneration, not a semantic version.
Variables ¶
var OnAllowRegister = define.OutboundEvent{ Host: Hostname, Method: "POST", Route: ":417/on-allow-register", In: OnAllowRegisterIn{}, Out: OnAllowRegisterOut{}, }
OnAllowRegister is triggered before registration to check if any sink blocks it.
var OnRegistered = define.OutboundEvent{ Host: Hostname, Method: "POST", Route: ":417/on-registered", In: OnRegisteredIn{}, Out: OnRegisteredOut{}, }
OnRegistered is triggered after successful registration.
var Register = define.Function{ Host: Hostname, Method: "ANY", Route: ":443/register", In: RegisterIn{}, Out: RegisterOut{}, }
Register attempts to register a new user.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a lightweight proxy for making unicast calls to the microservice.
func (Client) ForHost ¶
ForHost returns a copy of the client with a different hostname to be applied to requests.
type Hook ¶
type Hook struct {
// contains filtered or unexported fields
}
Hook assists in the subscription to the events of the microservice.
func NewHook ¶
func NewHook(listener service.Subscriber) Hook
NewHook creates a new hook to the events of the microservice.
func (Hook) ForHost ¶
ForHost returns a copy of the hook with a different hostname to be applied to the subscription.
func (Hook) OnAllowRegister ¶
func (c Hook) OnAllowRegister(handler func(ctx context.Context, email string) (allow bool, err error)) (unsub func() error, err error)
OnAllowRegister is triggered before registration to check if any sink blocks it.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is a lightweight proxy for making multicast calls to the microservice.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) MulticastClient
NewMulticastClient creates a new multicast client proxy to the microservice.
func (MulticastClient) ForHost ¶
func (_c MulticastClient) ForHost(host string) MulticastClient
ForHost returns a copy of the client with a different hostname to be applied to requests.
func (MulticastClient) Register ¶
func (_c MulticastClient) Register(ctx context.Context, email string) iter.Seq[*RegisterResponse]
Register attempts to register a new user.
func (MulticastClient) WithOptions ¶
func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient
WithOptions returns a copy of the client with options to be applied to requests.
type MulticastTrigger ¶
type MulticastTrigger struct {
// contains filtered or unexported fields
}
MulticastTrigger is a lightweight proxy for triggering the events of the microservice.
func NewMulticastTrigger ¶
func NewMulticastTrigger(caller service.Publisher) MulticastTrigger
NewMulticastTrigger creates a new multicast trigger of events of the microservice.
func (MulticastTrigger) ForHost ¶
func (_c MulticastTrigger) ForHost(host string) MulticastTrigger
ForHost returns a copy of the trigger with a different hostname to be applied to requests.
func (MulticastTrigger) OnAllowRegister ¶
func (_c MulticastTrigger) OnAllowRegister(ctx context.Context, email string) iter.Seq[*OnAllowRegisterResponse]
OnAllowRegister is triggered before registration to check if any sink blocks it.
func (MulticastTrigger) OnRegistered ¶
func (_c MulticastTrigger) OnRegistered(ctx context.Context, email string) iter.Seq[*OnRegisteredResponse]
OnRegistered is triggered after successful registration.
func (MulticastTrigger) WithOptions ¶
func (_c MulticastTrigger) WithOptions(opts ...pub.Option) MulticastTrigger
WithOptions returns a copy of the trigger with options to be applied to requests.
type OnAllowRegisterIn ¶
type OnAllowRegisterIn struct {
Email string `json:"email,omitzero"`
}
OnAllowRegisterIn are the input arguments of OnAllowRegister.
type OnAllowRegisterOut ¶
type OnAllowRegisterOut struct {
Allow bool `json:"allow,omitzero"`
}
OnAllowRegisterOut are the output arguments of OnAllowRegister.
type OnAllowRegisterResponse ¶
type OnAllowRegisterResponse multicastResponse // MARKER: OnAllowRegister
OnAllowRegisterResponse packs the response of OnAllowRegister.
func (*OnAllowRegisterResponse) Get ¶
func (_res *OnAllowRegisterResponse) Get() (allow bool, err error)
Get unpacks the return arguments of OnAllowRegister.
type OnRegisteredIn ¶
type OnRegisteredIn struct {
Email string `json:"email,omitzero"`
}
OnRegisteredIn are the input arguments of OnRegistered.
type OnRegisteredOut ¶
type OnRegisteredOut struct {
}
OnRegisteredOut are the output arguments of OnRegistered.
type OnRegisteredResponse ¶
type OnRegisteredResponse multicastResponse // MARKER: OnRegistered
OnRegisteredResponse packs the response of OnRegistered.
func (*OnRegisteredResponse) Get ¶
func (_res *OnRegisteredResponse) Get() (err error)
Get unpacks the return arguments of OnRegistered.
type RegisterIn ¶
type RegisterIn struct {
Email string `json:"email,omitzero"`
}
RegisterIn are the input arguments of Register.
type RegisterOut ¶
type RegisterOut struct {
Allowed bool `json:"allowed,omitzero"`
}
RegisterOut are the output arguments of Register.
type RegisterResponse ¶
type RegisterResponse multicastResponse // MARKER: Register
RegisterResponse packs the response of Register.
func (*RegisterResponse) Get ¶
func (_res *RegisterResponse) Get() (allowed bool, err error)
Get unpacks the return arguments of Register.