foofx

package
v1.37.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 6 Imported by: 0

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

type Result struct {
	fx.Out

	Client fooclient.Interface
}

Result defines the output of the Foo client module. It provides a Foo client to an Fx application.

type ServerParams

type ServerParams struct {
	fx.In

	Handler fooserver.Interface
}

ServerParams defines the dependencies for the Foo server.

type ServerResult

type ServerResult struct {
	fx.Out

	Procedures []transport.Procedure `group:"yarpcfx"`
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL