Documentation
¶
Index ¶
- Constants
- type Intermediate
- type Mock
- func (svc *Mock) HelloWorld(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) MockHelloWorld(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- type Service
- type ToDo
Constants ¶
const ( Hostname = helloworldapi.Hostname Version = 80 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶ added in v1.22.0
Intermediate extends and customizes the generic base connector.
func NewIntermediate ¶ added in v1.22.0
func NewIntermediate(impl ToDo) *Intermediate
NewIntermediate creates a new instance of the 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) HelloWorld ¶ added in v1.22.0
HelloWorld executes the mock handler.
func (*Mock) MockHelloWorld ¶ added in v1.22.0
func (svc *Mock) MockHelloWorld(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
MockHelloWorld sets up a mock handler for HelloWorld.
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 helloworld.example microservice.
The HelloWorld microservice demonstrates the classic minimalist example.
func (*Service) HelloWorld ¶
HelloWorld prints the classic greeting.
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)
HelloWorld(w http.ResponseWriter, r *http.Request) (err error) // MARKER: HelloWorld
}
ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.