Documentation

Overview

Package hellofx provides better integration for Fx for services implementing or calling Hello.

Clients

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

fx.Provide(hellofx.Client("..."))

Servers

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

Given,

func NewHelloHandler() helloserver.Interface

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

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

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

func Server

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

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

fx.Provide(
	func(h *MyHelloHandler) helloserver.Interface {
		return h
	},
	hellofx.Server(),
)

Types

type Params

type Params struct {
	fx.In

	Provider yarpc.ClientConfig
}

Params defines the dependencies for the Hello client.

type Result

type Result struct {
	fx.Out

	Client helloclient.Interface
}

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

type ServerParams

type ServerParams struct {
	fx.In

	Handler helloserver.Interface
}

ServerParams defines the dependencies for the Hello server.

type ServerResult

type ServerResult struct {
	fx.Out

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

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