Documentation

Overview

Package secondservicefx provides better integration for Fx for services implementing or calling SecondService.

Clients

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

fx.Provide(secondservicefx.Client("..."))

Servers

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

Given,

func NewSecondServiceHandler() secondserviceserver.Interface

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

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

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

func Server

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

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

fx.Provide(
	func(h *MySecondServiceHandler) secondserviceserver.Interface {
		return h
	},
	secondservicefx.Server(),
)

Types

type Params

type Params struct {
	fx.In

	Provider    yarpc.ClientConfig
	Restriction restriction.Checker `optional:"true"`
}

Params defines the dependencies for the SecondService client.

type Result

type Result struct {
	fx.Out

	Client secondserviceclient.Interface
}

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

type ServerParams

type ServerParams struct {
	fx.In

	Handler secondserviceserver.Interface
}

ServerParams defines the dependencies for the SecondService server.

type ServerResult

type ServerResult struct {
	fx.Out

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

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