Documentation
¶
Index ¶
- Constants
- 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) MockTickTock(handler func(ctx context.Context) (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 Service
- func (svc *Service) BusPNG(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) Calculator(w http.ResponseWriter, r *http.Request) error
- func (svc *Service) Echo(w http.ResponseWriter, r *http.Request) error
- func (svc *Service) Hello(w http.ResponseWriter, r *http.Request) error
- func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service
- func (svc *Service) Localization(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) OnShutdown(ctx context.Context) (err error)
- func (svc *Service) OnStartup(ctx context.Context) (err error)
- func (svc *Service) Ping(w http.ResponseWriter, r *http.Request) error
- func (svc *Service) Root(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Service) TickTock(ctx context.Context) error
- type ToDo
Constants ¶
const ( Hostname = helloapi.Hostname Version = helloapi.Version Description = helloapi.Description )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
Intermediate extends and customizes the generic base connector.
func NewIntermediate ¶
func NewIntermediate(impl ToDo) *Intermediate
NewIntermediate creates a new instance of the intermediate.
func (*Intermediate) Repeat ¶
func (svc *Intermediate) Repeat() (value int)
Repeat indicates how many times to display the greeting.
func (*Intermediate) SetGreeting ¶
func (svc *Intermediate) SetGreeting(value string) (err error)
SetGreeting sets the value of the configuration property.
func (*Intermediate) SetRepeat ¶
func (svc *Intermediate) SetRepeat(value int) (err error)
SetRepeat sets the value of the configuration property.
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) Calculator ¶
Calculator executes the mock handler.
func (*Mock) Localization ¶
Localization executes the mock handler.
func (*Mock) MockBusPNG ¶
MockBusPNG sets up a mock handler for BusPNG.
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 Calculator.
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 Localization.
func (*Mock) MockTickTock ¶
MockTickTock sets up a mock handler for TickTock.
func (*Mock) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
type Service ¶
type Service struct {
*Intermediate // IMPORTANT: Do not remove
}
Service implements the hello.example microservice.
The Hello microservice demonstrates the various capabilities of a microservice.
func (*Service) Calculator ¶
Calculator renders a UI for a calculator. The calculation operation is delegated to another microservice in order to demonstrate a call from one microservice to another.
func (*Service) Localization ¶
Localization prints hello in the language best matching the request's Accept-Language header.
func (*Service) OnShutdown ¶
OnShutdown is called when the microservice is shut down.
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) // MARKER: Hello
Echo(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Echo
Ping(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Ping
Calculator(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Calculator
BusPNG(w http.ResponseWriter, r *http.Request) (err error) // MARKER: BusPNG
Localization(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Localization
Root(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Root
TickTock(ctx context.Context) (err error) // MARKER: TickTock
}
ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.