storefx

package
v1.53.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package storefx provides better integration for Fx for services implementing or calling Store.

Clients

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

fx.Provide(storefx.Client("..."))

Servers

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

Given,

func NewStoreHandler() storeserver.Interface

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

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

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

func Server added in v1.22.0

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

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

fx.Provide(
	func(h *MyStoreHandler) storeserver.Interface {
		return h
	},
	storefx.Server(),
)

Types

type Params added in v1.13.0

type Params struct {
	fx.In

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

Params defines the dependencies for the Store client.

type Result added in v1.13.0

type Result struct {
	fx.Out

	Client storeclient.Interface
}

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

type ServerParams added in v1.22.0

type ServerParams struct {
	fx.In

	Handler storeserver.Interface
}

ServerParams defines the dependencies for the Store server.

type ServerResult added in v1.22.0

type ServerResult struct {
	fx.Out

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

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