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 ¶
- type Intermediate
- func (svc *Intermediate) AddNumOfOps(ctx context.Context, val int, op string, code int, success bool) error
- func (svc *Intermediate) IncrementMemoryAvailable(bytes int) errordeprecated
- func (svc *Intermediate) IncrementNumOfOps(val int, op string, code int, success bool) errordeprecated
- func (svc *Intermediate) ObserveMemoryAvailable(bytes int) errordeprecated
- func (svc *Intermediate) ObserveOpDurationSeconds(d time.Duration, op string, code int, success bool) errordeprecated
- func (svc *Intermediate) RecordMemoryAvailable(ctx context.Context, bytes int) error
- func (svc *Intermediate) RecordOpDurationSeconds(ctx context.Context, d time.Duration, op string, code int, success bool) error
- type Mock
- func (svc *Mock) AuthzRequired(ctx context.Context) (err error)
- func (svc *Mock) DirectoryServer(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) Echo(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) EchoAnything(ctx context.Context, original any) (echoed any, err error)
- func (svc *Mock) FunctionPathArguments(ctx context.Context, named string, path2 string, suffix string) (joined string, err error)
- func (svc *Mock) Hello(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) LinesIntersection(ctx context.Context, l1 testerapi.XYLine, l2 *testerapi.XYLine) (b bool, err error)
- func (svc *Mock) MockAuthzRequired(handler func(ctx context.Context) (err error)) *Mock
- func (svc *Mock) MockDirectoryServer(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) MockEchoAnything(handler func(ctx context.Context, original any) (echoed any, err error)) *Mock
- func (svc *Mock) MockFunctionPathArguments(...) *Mock
- func (svc *Mock) MockHello(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockLinesIntersection(...) *Mock
- func (svc *Mock) MockMultiValueHeaders(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockNonStringPathArguments(...) *Mock
- func (svc *Mock) MockOnDiscoveredSink(...) *Mock
- func (svc *Mock) MockPathArgumentsPriority(handler func(ctx context.Context, foo string) (echo string, err error)) *Mock
- func (svc *Mock) MockPointDistance(...) *Mock
- func (svc *Mock) MockShiftPoint(...) *Mock
- func (svc *Mock) MockStringCut(...) *Mock
- func (svc *Mock) MockSubArrayRange(...) *Mock
- func (svc *Mock) MockSumTwoIntegers(...) *Mock
- func (svc *Mock) MockUnnamedFunctionPathArguments(...) *Mock
- func (svc *Mock) MockUnnamedWebPathArguments(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockWebPathArguments(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock
- func (svc *Mock) MockWhatTimeIsIt(handler func(ctx context.Context) (t time.Time, err error)) *Mock
- func (svc *Mock) MultiValueHeaders(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) NonStringPathArguments(ctx context.Context, named int, path2 bool, suffix float64) (joined string, err error)
- func (svc *Mock) OnDiscoveredSink(ctx context.Context, p testerapi.XYCoord, n int) (q testerapi.XYCoord, m int, err error)
- func (svc *Mock) OnObserveMemoryAvailable(ctx context.Context) (err error)
- func (svc *Mock) OnShutdown(ctx context.Context) (err error)
- func (svc *Mock) OnStartup(ctx context.Context) (err error)
- func (svc *Mock) OnceAMinute(ctx context.Context) (err error)
- func (svc *Mock) PathArgumentsPriority(ctx context.Context, foo string) (echo string, err error)
- func (svc *Mock) PointDistance(ctx context.Context, p1 testerapi.XYCoord, p2 *testerapi.XYCoord) (d float64, err error)
- func (svc *Mock) ShiftPoint(ctx context.Context, p *testerapi.XYCoord, x float64, y float64) (shifted *testerapi.XYCoord, err error)
- func (svc *Mock) StringCut(ctx context.Context, s string, sep string) (before string, after string, found bool, err error)
- func (svc *Mock) SubArrayRange(ctx context.Context, httpRequestBody []int, min int, max int) (httpResponseBody []int, httpStatusCode int, err error)
- func (svc *Mock) SumTwoIntegers(ctx context.Context, x int, y int) (sum int, httpStatusCode int, err error)
- func (svc *Mock) UnnamedFunctionPathArguments(ctx context.Context, path1 string, path2 string, path3 string) (joined string, err error)
- func (svc *Mock) UnnamedWebPathArguments(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) WebPathArguments(w http.ResponseWriter, r *http.Request) (err error)
- func (svc *Mock) WhatTimeIsIt(ctx context.Context) (t time.Time, err error)
- type ToDo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intermediate ¶
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) AddNumOfOps ¶ added in v1.13.1
func (svc *Intermediate) AddNumOfOps(ctx context.Context, val int, op string, code int, success bool) error
AddNumOfOps adds to the value of the counter metric. NumOfOps counts the number of operations.
func (*Intermediate) IncrementMemoryAvailable
deprecated
added in
v1.13.1
func (svc *Intermediate) IncrementMemoryAvailable(bytes int) error
IncrementMemoryAvailable increments the value of the gauge metric. MemoryAvailable gauges the amount of available memory.
Deprecated: Use RecordMemoryAvailable
func (*Intermediate) IncrementNumOfOps
deprecated
added in
v1.13.1
func (*Intermediate) ObserveMemoryAvailable
deprecated
added in
v1.13.1
func (svc *Intermediate) ObserveMemoryAvailable(bytes int) error
ObserveMemoryAvailable observes the current value of the gauge metric. MemoryAvailable gauges the amount of available memory.
Deprecated: Use RecordMemoryAvailable
func (*Intermediate) ObserveOpDurationSeconds
deprecated
added in
v1.13.1
func (*Intermediate) RecordMemoryAvailable ¶ added in v1.13.1
func (svc *Intermediate) RecordMemoryAvailable(ctx context.Context, bytes int) error
RecordMemoryAvailable records the current value of the gauge metric. MemoryAvailable gauges the amount of available memory.
func (*Intermediate) RecordOpDurationSeconds ¶ added in v1.13.1
func (svc *Intermediate) RecordOpDurationSeconds(ctx context.Context, d time.Duration, op string, code int, success bool) error
RecordOpDurationSeconds records the current value of the histogram metric. OpDurationSeconds keeps track of the duration of operations.
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 (*Mock) AuthzRequired ¶ added in v1.13.1
AuthzRequired runs the mock handler set by MockAuthzRequired.
func (*Mock) DirectoryServer ¶
DirectoryServer runs the mock handler set by MockDirectoryServer.
func (*Mock) EchoAnything ¶ added in v1.13.1
EchoAnything runs the mock handler set by MockEchoAnything.
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) 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) MockAuthzRequired ¶ added in v1.13.1
MockAuthzRequired sets up a mock handler for the AuthzRequired endpoint.
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) MockEchoAnything ¶ added in v1.13.1
func (svc *Mock) MockEchoAnything(handler func(ctx context.Context, original any) (echoed any, err error)) *Mock
MockEchoAnything sets up a mock handler for the EchoAnything 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) 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 ¶
MockWhatTimeIsIt sets up a mock handler for the WhatTimeIsIt endpoint.
func (*Mock) MultiValueHeaders ¶
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) OnObserveMemoryAvailable ¶ added in v1.13.1
OnObserveMemoryAvailable is a no op.
func (*Mock) OnShutdown ¶
OnShutdown is a no op.
func (*Mock) OnStartup ¶
OnStartup makes sure that the mock is not executed in a non-dev environment.
func (*Mock) OnceAMinute ¶ added in v1.13.1
OnceAMinute is a no op.
func (*Mock) PathArgumentsPriority ¶
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 ¶
UnnamedWebPathArguments runs the mock handler set by MockUnnamedWebPathArguments.
func (*Mock) WebPathArguments ¶
WebPathArguments runs the mock handler set by MockWebPathArguments.
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) EchoAnything(ctx context.Context, original any) (echoed any, 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) AuthzRequired(ctx context.Context) (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) OnceAMinute(ctx context.Context) (err error) OnObserveMemoryAvailable(ctx context.Context) (err error) }
ToDo defines the interface that the microservice must implement. The intermediate delegates handling to this interface.