gatewaytest

package
v0.0.0-...-0001d10 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPublicRouter

func NewPublicRouter(config *gateway.Config, provider *Provider) *rpc.HttpRouter

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements a simple service provider based on the type of the service. Only one instance of a specific type may be added

func NewServices

func NewServices(ctx context.Context, config *gateway.Config) (*Provider, error)

func (*Provider) Add

func (p *Provider) Add(v interface{}) bool

Add adds a new type to the provider. Returns true on success, false if an instance of the same type has already been added

func (*Provider) Get

func (p *Provider) Get(v reflect.Type) (interface{}, bool)

Get retrieves the first instance of that type, or if v is an interface, that implements that type.

func (*Provider) MustAdd

func (p *Provider) MustAdd(v interface{})

MustAdd adds a new type to the provider. If there is already an instance of that type the method will panic

func (*Provider) MustGet

func (p *Provider) MustGet(v reflect.Type) interface{}

MustGet as get retrieves the first instance of a type, but panics if not found

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL