Documentation ¶
Overview ¶
Package foofx provides better integration for Fx for services implementing or calling Foo.
Clients ¶
If you are making requests to Foo, use the Client function to inject a Foo client into your container.
fx.Provide(foofx.Client("..."))
Servers ¶
If you are implementing Foo, provide a fooserver.Interface into the container and use the Server function.
Given,
func NewFooHandler() fooserver.Interface
You can do the following to have the procedures of Foo made available to an Fx application.
fx.Provide( NewFooHandler, foofx.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 Foo client to an Fx application using the given name for routing.
fx.Provide( foofx.Client("..."), newHandler, )
func Server ¶
func Server(opts ...thrift.RegisterOption) interface{}
Server provides procedures for Foo to an Fx application. It expects a foofx.Interface to be present in the container.
fx.Provide( func(h *MyFooHandler) fooserver.Interface { return h }, foofx.Server(), )
Types ¶
type Params ¶
type Params struct { fx.In Provider yarpc.ClientConfig }
Params defines the dependencies for the Foo client.
type Result ¶
Result defines the output of the Foo client module. It provides a Foo client to an Fx application.
type ServerParams ¶
ServerParams defines the dependencies for the Foo server.
type ServerResult ¶
ServerResult defines the output of Foo server module. It provides the procedures of a Foo 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.