Documentation
¶
Overview ¶
Code generated by Frodo - DO NOT EDIT.
Timestamp: Thu, 07 Mar 2024 09:43:11 EST Source: other_service.go Generator: https://github.com/bridgekitio/frodo
Code generated by Frodo - DO NOT EDIT.
Timestamp: Thu, 07 Mar 2024 09:43:11 EST Source: other_service.go Generator: https://github.com/bridgekitio/frodo
Code generated by Frodo - DO NOT EDIT.
Timestamp: Thu, 07 Mar 2024 09:43:12 EST Source: sample_service.go Generator: https://github.com/bridgekitio/frodo
Code generated by Frodo - DO NOT EDIT.
Timestamp: Thu, 07 Mar 2024 09:43:13 EST Source: sample_service.go Generator: https://github.com/bridgekitio/frodo
Code generated by Frodo - DO NOT EDIT.
Timestamp: Thu, 07 Mar 2024 09:43:12 EST Source: sample_service.go Generator: https://github.com/bridgekitio/frodo
Index ¶
- func OtherServiceClient(address string, options ...clients.ClientOption) testext.OtherService
- func OtherServiceServer(handler testext.OtherService, middleware ...services.MiddlewareFunc) *services.Service
- func SampleServiceClient(address string, options ...clients.ClientOption) testext.SampleService
- func SampleServiceServer(handler testext.SampleService, middleware ...services.MiddlewareFunc) *services.Service
- type MockSampleService
- func (mock *MockSampleService) Authorization(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) ComplexValues(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
- func (mock *MockSampleService) ComplexValuesPath(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
- func (mock *MockSampleService) CustomRoute(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) CustomRouteBody(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) CustomRouteQuery(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) Defaults(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) Download(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
- func (mock *MockSampleService) DownloadResumable(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
- func (mock *MockSampleService) Fail4XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) Fail5XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) FailAlways(ctx context.Context, request *testext.FailAlwaysRequest) (*testext.FailAlwaysResponse, error)
- func (mock *MockSampleService) ListenerA(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) ListenerB(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) OmitMe(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) OnFailAlways(ctx context.Context, request *testext.FailAlwaysErrorRequest) (*testext.FailAlwaysErrorResponse, error)
- func (mock *MockSampleService) Panic(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) Redirect(ctx context.Context, request *testext.SampleRedirectRequest) (*testext.SampleRedirectResponse, error)
- func (mock *MockSampleService) SecureWithRoles(ctx context.Context, request *testext.SampleSecurityRequest) (*testext.SampleSecurityResponse, error)
- func (mock *MockSampleService) Sleep(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) TriggerFailure(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) TriggerLowerCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
- func (mock *MockSampleService) TriggerUpperCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OtherServiceClient ¶
func OtherServiceClient(address string, options ...clients.ClientOption) testext.OtherService
OtherServiceClient creates an RPC client that conforms to the OtherService interface, but delegates work to remote instances. You must supply the base address of the remote service gateway instance or the load balancer for that service.
OtherService primarily exists to show that we can send event signals between services.
func OtherServiceServer ¶
func OtherServiceServer(handler testext.OtherService, middleware ...services.MiddlewareFunc) *services.Service
OtherServiceServer accepts your "real" OtherService instance (the thing that really does the work), and returns a set of endpoint routes which allow this service to be consumed via the gateways/listeners you configure in main().
// Example serviceHandler := testext.OtherServiceHandler{ /* set up to your liking */ } server := services.New( services.Listen(apis.NewGateway()), services.Register(testextgen.OtherServiceServer(serviceHandler)), ) server.Listen()
From there, you can add middleware, event sourcing support and more. Look at the frodo documentation for more details/examples on how to make your service production ready.
func SampleServiceClient ¶
func SampleServiceClient(address string, options ...clients.ClientOption) testext.SampleService
SampleServiceClient creates an RPC client that conforms to the SampleService interface, but delegates work to remote instances. You must supply the base address of the remote service gateway instance or the load balancer for that service.
SampleService is a mix of different options, parameter setups, and responses so that we can run integration tests using our code-generated clients. Each method is nothing special, but they each do something a little differently than the rest to flex different parts of the framework.
func SampleServiceServer ¶
func SampleServiceServer(handler testext.SampleService, middleware ...services.MiddlewareFunc) *services.Service
SampleServiceServer accepts your "real" SampleService instance (the thing that really does the work), and returns a set of endpoint routes which allow this service to be consumed via the gateways/listeners you configure in main().
// Example serviceHandler := testext.SampleServiceHandler{ /* set up to your liking */ } server := services.New( services.Listen(apis.NewGateway()), services.Register(testextgen.SampleServiceServer(serviceHandler)), ) server.Listen()
From there, you can add middleware, event sourcing support and more. Look at the frodo documentation for more details/examples on how to make your service production ready.
Types ¶
type MockSampleService ¶
type MockSampleService struct { AuthorizationFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) ComplexValuesFunc func(context.Context, *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error) ComplexValuesPathFunc func(context.Context, *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error) CustomRouteFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) CustomRouteBodyFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) CustomRouteQueryFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) DefaultsFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) DownloadFunc func(context.Context, *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error) DownloadResumableFunc func(context.Context, *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error) Fail4XXFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) Fail5XXFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) FailAlwaysFunc func(context.Context, *testext.FailAlwaysRequest) (*testext.FailAlwaysResponse, error) ListenerAFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) ListenerBFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) OmitMeFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) OnFailAlwaysFunc func(context.Context, *testext.FailAlwaysErrorRequest) (*testext.FailAlwaysErrorResponse, error) PanicFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) RedirectFunc func(context.Context, *testext.SampleRedirectRequest) (*testext.SampleRedirectResponse, error) SecureWithRolesFunc func(context.Context, *testext.SampleSecurityRequest) (*testext.SampleSecurityResponse, error) SleepFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) TriggerFailureFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) TriggerLowerCaseFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) TriggerUpperCaseFunc func(context.Context, *testext.SampleRequest) (*testext.SampleResponse, error) Calls struct { Authorization callsSampleServiceAuthorization ComplexValues callsSampleServiceComplexValues ComplexValuesPath callsSampleServiceComplexValuesPath CustomRoute callsSampleServiceCustomRoute CustomRouteBody callsSampleServiceCustomRouteBody CustomRouteQuery callsSampleServiceCustomRouteQuery Defaults callsSampleServiceDefaults Download callsSampleServiceDownload DownloadResumable callsSampleServiceDownloadResumable Fail4XX callsSampleServiceFail4XX Fail5XX callsSampleServiceFail5XX FailAlways callsSampleServiceFailAlways ListenerA callsSampleServiceListenerA ListenerB callsSampleServiceListenerB OmitMe callsSampleServiceOmitMe OnFailAlways callsSampleServiceOnFailAlways Panic callsSampleServicePanic Redirect callsSampleServiceRedirect SecureWithRoles callsSampleServiceSecureWithRoles Sleep callsSampleServiceSleep TriggerFailure callsSampleServiceTriggerFailure TriggerLowerCase callsSampleServiceTriggerLowerCase TriggerUpperCase callsSampleServiceTriggerUpperCase } }
MockSampleService allows you to program behaviors into a mock instance of SampleService. You supply dynamic functions named "XxxFunc" to provide the custom behavior; so if your service has a function called 'CreateUser', you supply a function for 'CreateUserFunc'.
You do not need to supply behaviors for every single service function; just the ones you plan to test. If you do invoke a function without a programmed behavior, it will just return an error with a message indicating that it wasn't implemented.
func (*MockSampleService) Authorization ¶
func (mock *MockSampleService) Authorization(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) ComplexValues ¶
func (mock *MockSampleService) ComplexValues(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
func (*MockSampleService) ComplexValuesPath ¶
func (mock *MockSampleService) ComplexValuesPath(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
func (*MockSampleService) CustomRoute ¶
func (mock *MockSampleService) CustomRoute(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) CustomRouteBody ¶
func (mock *MockSampleService) CustomRouteBody(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) CustomRouteQuery ¶
func (mock *MockSampleService) CustomRouteQuery(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Defaults ¶
func (mock *MockSampleService) Defaults(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Download ¶
func (mock *MockSampleService) Download(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
func (*MockSampleService) DownloadResumable ¶
func (mock *MockSampleService) DownloadResumable(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
func (*MockSampleService) Fail4XX ¶
func (mock *MockSampleService) Fail4XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Fail5XX ¶
func (mock *MockSampleService) Fail5XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) FailAlways ¶ added in v0.1.4
func (mock *MockSampleService) FailAlways(ctx context.Context, request *testext.FailAlwaysRequest) (*testext.FailAlwaysResponse, error)
func (*MockSampleService) ListenerA ¶
func (mock *MockSampleService) ListenerA(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) ListenerB ¶
func (mock *MockSampleService) ListenerB(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) OmitMe ¶
func (mock *MockSampleService) OmitMe(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) OnFailAlways ¶ added in v0.1.4
func (mock *MockSampleService) OnFailAlways(ctx context.Context, request *testext.FailAlwaysErrorRequest) (*testext.FailAlwaysErrorResponse, error)
func (*MockSampleService) Panic ¶
func (mock *MockSampleService) Panic(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Redirect ¶
func (mock *MockSampleService) Redirect(ctx context.Context, request *testext.SampleRedirectRequest) (*testext.SampleRedirectResponse, error)
func (*MockSampleService) SecureWithRoles ¶
func (mock *MockSampleService) SecureWithRoles(ctx context.Context, request *testext.SampleSecurityRequest) (*testext.SampleSecurityResponse, error)
func (*MockSampleService) Sleep ¶
func (mock *MockSampleService) Sleep(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerFailure ¶
func (mock *MockSampleService) TriggerFailure(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerLowerCase ¶
func (mock *MockSampleService) TriggerLowerCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerUpperCase ¶
func (mock *MockSampleService) TriggerUpperCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)