namefx

package
v1.74.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package namefx provides better integration for Fx for services implementing or calling Name.

Clients

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

fx.Provide(namefx.Client("..."))

Servers

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

Given,

func NewNameHandler() nameserver.Interface

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

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

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

func Server

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

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

fx.Provide(
	func(h *MyNameHandler) nameserver.Interface {
		return h
	},
	namefx.Server(),
)

Types

type Params

type Params struct {
	fx.In

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

Params defines the dependencies for the Name client.

type Result

type Result struct {
	fx.Out

	Client nameclient.Interface
}

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

type ServerParams

type ServerParams struct {
	fx.In

	Handler nameserver.Interface
}

ServerParams defines the dependencies for the Name server.

type ServerResult

type ServerResult struct {
	fx.Out

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

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