barfx

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package barfx provides better integration for Fx for services implementing or calling Bar.

Clients

If you are making requests to Bar, use the Client function to inject a Bar client into your container.

fx.Provide(barfx.Client("..."))

Servers

If you are implementing Bar, provide a barserver.Interface into the container and use the Server function.

Given,

func NewBarHandler() barserver.Interface

You can do the following to have the procedures of Bar made available to an Fx application.

fx.Provide(
	NewBarHandler,
	barfx.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 Bar client to an Fx application using the given name for routing.

fx.Provide(
	barfx.Client("..."),
	newHandler,
)

func Server

func Server(opts ...thrift.RegisterOption) interface{}

Server provides procedures for Bar to an Fx application. It expects a barfx.Interface to be present in the container.

fx.Provide(
	func(h *MyBarHandler) barserver.Interface {
		return h
	},
	barfx.Server(),
)

Types

type Params

type Params struct {
	fx.In

	Provider yarpc.ClientConfig
}

Params defines the dependencies for the Bar client.

type Result

type Result struct {
	fx.Out

	Client barclient.Interface
}

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

type ServerParams

type ServerParams struct {
	fx.In

	Handler barserver.Interface
}

ServerParams defines the dependencies for the Bar server.

type ServerResult

type ServerResult struct {
	fx.Out

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

ServerResult defines the output of Bar server module. It provides the procedures of a Bar 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