intermediate

package
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package intermediate serves as the foundation of the hello.example microservice.

The Hello microservice demonstrates the various capabilities of a microservice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate

type Intermediate struct {
	*connector.Connector
	// contains filtered or unexported fields
}

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.

Greeting to use.

func (*Intermediate) SetRepeat

func (svc *Intermediate) SetRepeat(count int) error

SetRepeat sets the value of the configuration property.

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 NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) BusPNG

func (svc *Mock) BusPNG(w http.ResponseWriter, r *http.Request) (err error)

BusPNG runs the mock handler set by MockBusPNG.

func (*Mock) Calculator

func (svc *Mock) Calculator(w http.ResponseWriter, r *http.Request) (err error)

Calculator runs the mock handler set by MockCalculator.

func (*Mock) Echo

func (svc *Mock) Echo(w http.ResponseWriter, r *http.Request) (err error)

Echo runs the mock handler set by MockEcho.

func (*Mock) Hello

func (svc *Mock) Hello(w http.ResponseWriter, r *http.Request) (err error)

Hello runs the mock handler set by MockHello.

func (*Mock) Localization

func (svc *Mock) Localization(w http.ResponseWriter, r *http.Request) (err error)

Localization runs the mock handler set by MockLocalization.

func (*Mock) MockBusPNG

func (svc *Mock) MockBusPNG(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

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) MockEcho

func (svc *Mock) MockEcho(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockEcho sets up a mock handler for the Echo endpoint.

func (*Mock) MockHello

func (svc *Mock) MockHello(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockHello sets up a mock handler for the Hello 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) MockPing

func (svc *Mock) MockPing(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockPing sets up a mock handler for the Ping endpoint.

func (*Mock) MockRoot

func (svc *Mock) MockRoot(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockRoot sets up a mock handler for the Root endpoint.

func (*Mock) OnShutdown

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is a no op.

func (*Mock) OnStartup

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup makes sure that the mock is not executed in a non-dev environment.

func (*Mock) Ping

func (svc *Mock) Ping(w http.ResponseWriter, r *http.Request) (err error)

Ping runs the mock handler set by MockPing.

func (*Mock) Root

func (svc *Mock) Root(w http.ResponseWriter, r *http.Request) (err error)

Root runs the mock handler set by MockRoot.

func (*Mock) TickTock

func (svc *Mock) TickTock(ctx context.Context) (err error)

TickTock is a no op.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL