Documentation ¶
Overview ¶
Package testservicefx provides better integration for Fx for services implementing or calling TestService.
Clients ¶
If you are making requests to TestService, use the Client function to inject a TestService client into your container.
fx.Provide(testservicefx.Client("..."))
Servers ¶
If you are implementing TestService, provide a testserviceserver.Interface into the container and use the Server function.
Given,
func NewTestServiceHandler() testserviceserver.Interface
You can do the following to have the procedures of TestService made available to an Fx application.
fx.Provide( NewTestServiceHandler, testservicefx.Server(), )
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Client ¶
func Client(name string, opts ...thrift.ClientOption) interface{}
Client provides a TestService client to an Fx application using the given name for routing.
fx.Provide( testservicefx.Client("..."), newHandler, )
func Server ¶
func Server(opts ...thrift.RegisterOption) interface{}
Server provides procedures for TestService to an Fx application. It expects a testservicefx.Interface to be present in the container.
fx.Provide( func(h *MyTestServiceHandler) testserviceserver.Interface { return h }, testservicefx.Server(), )
Types ¶
type Params ¶
type Params struct { fx.In Provider yarpc.ClientConfig Restriction restriction.Checker `optional:"true"` }
Params defines the dependencies for the TestService client.
type Result ¶
type Result struct { fx.Out Client testserviceclient.Interface }
Result defines the output of the TestService client module. It provides a TestService client to an Fx application.
type ServerParams ¶
type ServerParams struct { fx.In Handler testserviceserver.Interface }
ServerParams defines the dependencies for the TestService server.
type ServerResult ¶
ServerResult defines the output of TestService server module. It provides the procedures of a TestService handler to an Fx application.
The procedures are provided to the "yarpcfx" value group. Dig 1.2 or newer must be used for this feature to work.