helloworld

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = helloworldapi.Hostname
	Version  = 80
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate added in v1.22.0

type Intermediate struct {
	*connector.Connector
	ToDo
}

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 NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) HelloWorld added in v1.22.0

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

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

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

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup added in v1.22.0

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

OnStartup is called when the microservice is started up.

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 NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) HelloWorld

func (svc *Service) HelloWorld(w http.ResponseWriter, r *http.Request) (err error)

HelloWorld prints the classic greeting.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) OnShutdown

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

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

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

OnStartup is called when the microservice is started up.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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