Documentation
¶
Overview ¶
Package intermediate serves as the foundation of the hello.example microservice.
The Hello microservice demonstrates the various capabilities of a microservice.
Index ¶
- type Intermediate
- type Mock
- func (svc *Mock) BusPNG(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Calculator(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Echo(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Hello(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Localization(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) MockBusPNG(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockCalculator(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockEcho(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockHello(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockLocalization(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockPing(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockRoot(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)
- func (svc *Mock) Ping(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Root(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) TickTock(ctx context.Context) (err error)
- type ToDo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
Intermediate extends and customizes the generic base connector. Code generated microservices then extend the intermediate.
func NewService ¶
func NewService(impl ToDo, version int) *Intermediate
NewService creates a new intermediate service.
func (*Intermediate) Greeting ¶
func (svc *Intermediate) Greeting() (greeting string)
Greeting to use.
func (*Intermediate) Repeat ¶
func (svc *Intermediate) Repeat() (count int)
Repeat indicates how many times to display the greeting.
func (*Intermediate) SetGreeting ¶
func (svc *Intermediate) SetGreeting(greeting string) error
SetGreeting sets the value of the configuration property. This action is restricted to the TESTING deployment in which the fetching of values from the configurator is disabled.
Greeting to use.
func (*Intermediate) SetRepeat ¶
func (svc *Intermediate) SetRepeat(count int) error
SetRepeat sets the value of the configuration property. This action is restricted to the TESTING deployment in which the fetching of values from the configurator is disabled.
Repeat indicates how many times to display the greeting.
type Mock ¶
type Mock struct {
*Intermediate
// contains filtered or unexported fields
}
Mock is a mockable version of the hello.example microservice, allowing functions, event sinks and web handlers to be mocked.
func (*Mock) Calculator ¶
Calculator runs the mock handler set by MockCalculator.
func (*Mock) Localization ¶
Localization runs the mock handler set by MockLocalization.
func (*Mock) MockBusPNG ¶
MockBusPNG sets up a mock handler for the BusPNG endpoint.
func (*Mock) MockCalculator ¶
func (svc *Mock) MockCalculator(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
MockCalculator sets up a mock handler for the Calculator endpoint.
func (*Mock) MockLocalization ¶
func (svc *Mock) MockLocalization(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
MockLocalization sets up a mock handler for the Localization endpoint.
func (*Mock) OnShutdown ¶
OnShutdown is a no op.
func (*Mock) OnStartup ¶
OnStartup makes sure that the mock is not executed in a non-dev environment.
type ToDo ¶
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
Hello(w http.ResponseWriter, r *http.Request) (err error)
Echo(w http.ResponseWriter, r *http.Request) (err error)
Ping(w http.ResponseWriter, r *http.Request) (err error)
Calculator(w http.ResponseWriter, r *http.Request) (err error)
BusPNG(w http.ResponseWriter, r *http.Request) (err error)
Localization(w http.ResponseWriter, r *http.Request) (err error)
Root(w http.ResponseWriter, r *http.Request) (err error)
TickTock(ctx context.Context) (err error)
}
ToDo defines the interface that the microservice must implement. The intermediate delegates handling to this interface.