intermediate

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package intermediate serves as the foundation of the codegen.test microservice.

The tester is used to test the code generator's functions.

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.

type Mock

type Mock struct {
	*Intermediate
	// contains filtered or unexported fields
}

Mock is a mockable version of the codegen.test 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) DirectoryServer

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

DirectoryServer runs the mock handler set by MockDirectoryServer.

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

func (svc *Mock) FunctionPathArguments(ctx context.Context, named string, path2 string, suffix string) (joined string, err error)

FunctionPathArguments runs the mock handler set by MockFunctionPathArguments.

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

func (svc *Mock) LinesIntersection(ctx context.Context, l1 testerapi.XYLine, l2 *testerapi.XYLine) (b bool, err error)

LinesIntersection runs the mock handler set by MockLinesIntersection.

func (*Mock) MockDirectoryServer

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

MockDirectoryServer sets up a mock handler for the DirectoryServer 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) MockFunctionPathArguments

func (svc *Mock) MockFunctionPathArguments(handler func(ctx context.Context, named string, path2 string, suffix string) (joined string, err error)) *Mock

MockFunctionPathArguments sets up a mock handler for the FunctionPathArguments 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) MockLinesIntersection

func (svc *Mock) MockLinesIntersection(handler func(ctx context.Context, l1 testerapi.XYLine, l2 *testerapi.XYLine) (b bool, err error)) *Mock

MockLinesIntersection sets up a mock handler for the LinesIntersection endpoint.

func (*Mock) MockMultiValueHeaders

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

MockMultiValueHeaders sets up a mock handler for the MultiValueHeaders endpoint.

func (*Mock) MockNonStringPathArguments

func (svc *Mock) MockNonStringPathArguments(handler func(ctx context.Context, named int, path2 bool, suffix float64) (joined string, err error)) *Mock

MockNonStringPathArguments sets up a mock handler for the NonStringPathArguments endpoint.

func (*Mock) MockOnDiscoveredSink

func (svc *Mock) MockOnDiscoveredSink(handler func(ctx context.Context, p testerapi.XYCoord, n int) (q testerapi.XYCoord, m int, err error)) *Mock

MockOnDiscoveredSink sets up a mock handler for the OnDiscoveredSink endpoint.

func (*Mock) MockPathArgumentsPriority

func (svc *Mock) MockPathArgumentsPriority(handler func(ctx context.Context, foo string) (echo string, err error)) *Mock

MockPathArgumentsPriority sets up a mock handler for the PathArgumentsPriority endpoint.

func (*Mock) MockPointDistance

func (svc *Mock) MockPointDistance(handler func(ctx context.Context, p1 testerapi.XYCoord, p2 *testerapi.XYCoord) (d float64, err error)) *Mock

MockPointDistance sets up a mock handler for the PointDistance endpoint.

func (*Mock) MockShiftPoint

func (svc *Mock) MockShiftPoint(handler func(ctx context.Context, p *testerapi.XYCoord, x float64, y float64) (shifted *testerapi.XYCoord, err error)) *Mock

MockShiftPoint sets up a mock handler for the ShiftPoint endpoint.

func (*Mock) MockStringCut

func (svc *Mock) MockStringCut(handler func(ctx context.Context, s string, sep string) (before string, after string, found bool, err error)) *Mock

MockStringCut sets up a mock handler for the StringCut endpoint.

func (*Mock) MockSubArrayRange

func (svc *Mock) MockSubArrayRange(handler func(ctx context.Context, httpRequestBody []int, min int, max int) (httpResponseBody []int, httpStatusCode int, err error)) *Mock

MockSubArrayRange sets up a mock handler for the SubArrayRange endpoint.

func (*Mock) MockSumTwoIntegers

func (svc *Mock) MockSumTwoIntegers(handler func(ctx context.Context, x int, y int) (sum int, httpStatusCode int, err error)) *Mock

MockSumTwoIntegers sets up a mock handler for the SumTwoIntegers endpoint.

func (*Mock) MockUnnamedFunctionPathArguments

func (svc *Mock) MockUnnamedFunctionPathArguments(handler func(ctx context.Context, path1 string, path2 string, path3 string) (joined string, err error)) *Mock

MockUnnamedFunctionPathArguments sets up a mock handler for the UnnamedFunctionPathArguments endpoint.

func (*Mock) MockUnnamedWebPathArguments

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

MockUnnamedWebPathArguments sets up a mock handler for the UnnamedWebPathArguments endpoint.

func (*Mock) MockWebPathArguments

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

MockWebPathArguments sets up a mock handler for the WebPathArguments endpoint.

func (*Mock) MockWhatTimeIsIt

func (svc *Mock) MockWhatTimeIsIt(handler func(ctx context.Context) (t time.Time, err error)) *Mock

MockWhatTimeIsIt sets up a mock handler for the WhatTimeIsIt endpoint.

func (*Mock) MultiValueHeaders

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

MultiValueHeaders runs the mock handler set by MockMultiValueHeaders.

func (*Mock) NonStringPathArguments

func (svc *Mock) NonStringPathArguments(ctx context.Context, named int, path2 bool, suffix float64) (joined string, err error)

NonStringPathArguments runs the mock handler set by MockNonStringPathArguments.

func (*Mock) OnDiscoveredSink

func (svc *Mock) OnDiscoveredSink(ctx context.Context, p testerapi.XYCoord, n int) (q testerapi.XYCoord, m int, err error)

OnDiscoveredSink runs the mock handler set by MockOnDiscoveredSink.

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

func (svc *Mock) PathArgumentsPriority(ctx context.Context, foo string) (echo string, err error)

PathArgumentsPriority runs the mock handler set by MockPathArgumentsPriority.

func (*Mock) PointDistance

func (svc *Mock) PointDistance(ctx context.Context, p1 testerapi.XYCoord, p2 *testerapi.XYCoord) (d float64, err error)

PointDistance runs the mock handler set by MockPointDistance.

func (*Mock) ShiftPoint

func (svc *Mock) ShiftPoint(ctx context.Context, p *testerapi.XYCoord, x float64, y float64) (shifted *testerapi.XYCoord, err error)

ShiftPoint runs the mock handler set by MockShiftPoint.

func (*Mock) StringCut

func (svc *Mock) StringCut(ctx context.Context, s string, sep string) (before string, after string, found bool, err error)

StringCut runs the mock handler set by MockStringCut.

func (*Mock) SubArrayRange

func (svc *Mock) SubArrayRange(ctx context.Context, httpRequestBody []int, min int, max int) (httpResponseBody []int, httpStatusCode int, err error)

SubArrayRange runs the mock handler set by MockSubArrayRange.

func (*Mock) SumTwoIntegers

func (svc *Mock) SumTwoIntegers(ctx context.Context, x int, y int) (sum int, httpStatusCode int, err error)

SumTwoIntegers runs the mock handler set by MockSumTwoIntegers.

func (*Mock) UnnamedFunctionPathArguments

func (svc *Mock) UnnamedFunctionPathArguments(ctx context.Context, path1 string, path2 string, path3 string) (joined string, err error)

UnnamedFunctionPathArguments runs the mock handler set by MockUnnamedFunctionPathArguments.

func (*Mock) UnnamedWebPathArguments

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

UnnamedWebPathArguments runs the mock handler set by MockUnnamedWebPathArguments.

func (*Mock) WebPathArguments

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

WebPathArguments runs the mock handler set by MockWebPathArguments.

func (*Mock) WhatTimeIsIt

func (svc *Mock) WhatTimeIsIt(ctx context.Context) (t time.Time, err error)

WhatTimeIsIt runs the mock handler set by MockWhatTimeIsIt.

type ToDo

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	StringCut(ctx context.Context, s string, sep string) (before string, after string, found bool, err error)
	PointDistance(ctx context.Context, p1 testerapi.XYCoord, p2 *testerapi.XYCoord) (d float64, err error)
	ShiftPoint(ctx context.Context, p *testerapi.XYCoord, x float64, y float64) (shifted *testerapi.XYCoord, err error)
	LinesIntersection(ctx context.Context, l1 testerapi.XYLine, l2 *testerapi.XYLine) (b bool, err error)
	SubArrayRange(ctx context.Context, httpRequestBody []int, min int, max int) (httpResponseBody []int, httpStatusCode int, err error)
	SumTwoIntegers(ctx context.Context, x int, y int) (sum int, httpStatusCode int, err error)
	FunctionPathArguments(ctx context.Context, named string, path2 string, suffix string) (joined string, err error)
	NonStringPathArguments(ctx context.Context, named int, path2 bool, suffix float64) (joined string, err error)
	UnnamedFunctionPathArguments(ctx context.Context, path1 string, path2 string, path3 string) (joined string, err error)
	PathArgumentsPriority(ctx context.Context, foo string) (echo string, err error)
	WhatTimeIsIt(ctx context.Context) (t time.Time, err error)
	OnDiscoveredSink(ctx context.Context, p testerapi.XYCoord, n int) (q testerapi.XYCoord, m int, err error)
	Echo(w http.ResponseWriter, r *http.Request) (err error)
	MultiValueHeaders(w http.ResponseWriter, r *http.Request) (err error)
	WebPathArguments(w http.ResponseWriter, r *http.Request) (err error)
	UnnamedWebPathArguments(w http.ResponseWriter, r *http.Request) (err error)
	DirectoryServer(w http.ResponseWriter, r *http.Request) (err error)
	Hello(w http.ResponseWriter, r *http.Request) (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