echofx

package
v1.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package echofx provides better integration for Fx for services implementing or calling Echo.

Clients

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

fx.Provide(echofx.Client("..."))

Servers

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

Given,

func NewEchoHandler() echoserver.Interface

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

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

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

func Server added in v1.22.0

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

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

fx.Provide(
	func(h *MyEchoHandler) echoserver.Interface {
		return h
	},
	echofx.Server(),
)

Types

type Params added in v1.13.0

type Params struct {
	fx.In

	Provider yarpc.ClientConfig
}

Params defines the dependencies for the Echo client.

type Result added in v1.13.0

type Result struct {
	fx.Out

	Client echoclient.Interface
}

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

type ServerParams added in v1.22.0

type ServerParams struct {
	fx.In

	Handler echoserver.Interface
}

ServerParams defines the dependencies for the Echo server.

type ServerResult added in v1.22.0

type ServerResult struct {
	fx.Out

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

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