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 = 325 )
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.
func (*Intermediate) Greeting ¶ added in v1.22.0
func (svc *Intermediate) Greeting() (value string)
Greeting to use.
func (*Intermediate) Repeat ¶ added in v1.22.0
func (svc *Intermediate) Repeat() (value int)
Repeat indicates how many times to display the greeting.
func (*Intermediate) SetGreeting ¶ added in v1.22.0
func (svc *Intermediate) SetGreeting(value string) (err error)
SetGreeting sets the value of the configuration property.
func (*Intermediate) SetRepeat ¶ added in v1.22.0
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 ¶ added in v1.22.0
Calculator executes the mock handler.
func (*Mock) Localization ¶ added in v1.22.0
Localization executes the mock handler.
func (*Mock) MockBusPNG ¶ added in v1.22.0
MockBusPNG sets up a mock handler for BusPNG.
func (*Mock) MockCalculator ¶ added in v1.22.0
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 ¶ added in v1.22.0
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 ¶ added in v1.22.0
MockTickTock sets up a mock handler for TickTock.
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 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 ¶ added in v1.22.0
type ToDo interface {
OnStartup(ctx context.Context) (err error)
OnShutdown(ctx context.Context) (err error)
Hello(w http.ResponseWriter, r *http.Request) error // MARKER: Hello
Echo(w http.ResponseWriter, r *http.Request) error // MARKER: Echo
Ping(w http.ResponseWriter, r *http.Request) error // MARKER: Ping
Calculator(w http.ResponseWriter, r *http.Request) 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) error // MARKER: TickTock
}
ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.