Documentation
¶
Overview ¶
Code generated by Abide - DO NOT EDIT.
Timestamp: Tue, 11 Jul 2023 10:09:22 EDT Source: other_service.go Generator: https://github.com/monadicstack/abide
Code generated by Abide - DO NOT EDIT.
Timestamp: Tue, 11 Jul 2023 10:09:22 EDT Source: other_service.go Generator: https://github.com/monadicstack/abide
Code generated by Abide - DO NOT EDIT.
Timestamp: Tue, 11 Jul 2023 10:09:23 EDT Source: sample_service.go Generator: https://github.com/monadicstack/abide
Code generated by Abide - DO NOT EDIT.
Timestamp: Tue, 11 Jul 2023 10:09:24 EDT Source: sample_service.go Generator: https://github.com/monadicstack/abide
Code generated by Abide - DO NOT EDIT.
Timestamp: Tue, 11 Jul 2023 10:09:22 EDT Source: sample_service.go Generator: https://github.com/monadicstack/abide
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) 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) 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 abide 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 abide documentation for more details/examples on how to make your service production ready.
Types ¶
type MockSampleService ¶ added in v0.1.1
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)
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)
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
ListenerA callsSampleServiceListenerA
ListenerB callsSampleServiceListenerB
OmitMe callsSampleServiceOmitMe
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 ¶ added in v0.1.1
func (mock *MockSampleService) Authorization(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) ComplexValues ¶ added in v0.1.1
func (mock *MockSampleService) ComplexValues(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
func (*MockSampleService) ComplexValuesPath ¶ added in v0.1.1
func (mock *MockSampleService) ComplexValuesPath(ctx context.Context, request *testext.SampleComplexRequest) (*testext.SampleComplexResponse, error)
func (*MockSampleService) CustomRoute ¶ added in v0.1.1
func (mock *MockSampleService) CustomRoute(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) CustomRouteBody ¶ added in v0.1.1
func (mock *MockSampleService) CustomRouteBody(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) CustomRouteQuery ¶ added in v0.1.1
func (mock *MockSampleService) CustomRouteQuery(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Defaults ¶ added in v0.1.1
func (mock *MockSampleService) Defaults(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Download ¶ added in v0.1.1
func (mock *MockSampleService) Download(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
func (*MockSampleService) DownloadResumable ¶ added in v0.1.1
func (mock *MockSampleService) DownloadResumable(ctx context.Context, request *testext.SampleDownloadRequest) (*testext.SampleDownloadResponse, error)
func (*MockSampleService) Fail4XX ¶ added in v0.1.1
func (mock *MockSampleService) Fail4XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Fail5XX ¶ added in v0.1.1
func (mock *MockSampleService) Fail5XX(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) ListenerA ¶ added in v0.1.1
func (mock *MockSampleService) ListenerA(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) ListenerB ¶ added in v0.1.1
func (mock *MockSampleService) ListenerB(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) OmitMe ¶ added in v0.1.1
func (mock *MockSampleService) OmitMe(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) Redirect ¶ added in v0.1.1
func (mock *MockSampleService) Redirect(ctx context.Context, request *testext.SampleRedirectRequest) (*testext.SampleRedirectResponse, error)
func (*MockSampleService) SecureWithRoles ¶ added in v0.1.1
func (mock *MockSampleService) SecureWithRoles(ctx context.Context, request *testext.SampleSecurityRequest) (*testext.SampleSecurityResponse, error)
func (*MockSampleService) Sleep ¶ added in v0.1.1
func (mock *MockSampleService) Sleep(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerFailure ¶ added in v0.1.1
func (mock *MockSampleService) TriggerFailure(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerLowerCase ¶ added in v0.1.1
func (mock *MockSampleService) TriggerLowerCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)
func (*MockSampleService) TriggerUpperCase ¶ added in v0.1.1
func (mock *MockSampleService) TriggerUpperCase(ctx context.Context, request *testext.SampleRequest) (*testext.SampleResponse, error)