weatherfx

package
v1.35.1 Latest Latest
Warning

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

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

Documentation

Overview

Package weatherfx provides better integration for Fx for services implementing or calling Weather.

Clients

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

fx.Provide(weatherfx.Client("..."))

Servers

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

Given,

func NewWeatherHandler() weatherserver.Interface

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

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

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

func Server added in v1.22.0

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

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

fx.Provide(
	func(h *MyWeatherHandler) weatherserver.Interface {
		return h
	},
	weatherfx.Server(),
)

Types

type Params

type Params struct {
	fx.In

	Provider yarpc.ClientConfig
}

Params defines the dependencies for the Weather client.

type Result

type Result struct {
	fx.Out

	Client weatherclient.Interface
}

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

type ServerParams added in v1.22.0

type ServerParams struct {
	fx.In

	Handler weatherserver.Interface
}

ServerParams defines the dependencies for the Weather server.

type ServerResult added in v1.22.0

type ServerResult struct {
	fx.Out

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

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