method

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(instance interface{}, method string) interface{}

Get returns a function for specified method. If you want to specify a method from an interface, you need to use (*ArbitraryInterface)(nil) as instance.

func Put

func Put(instance interface{})

Put puts an instance in this container. The instance must have one or more methods.

func PutInterface

func PutInterface(iface interface{}, instance interface{})

PutInterface puts an instance in this container. The instance must have one or more methods. The iface should be like (*ArbitraryInterface)(nil).

Types

type Container

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

Container contains instances and mappings.

func NewContainer

func NewContainer() *Container

NewContainer creates a method container.

func (*Container) Get

func (c *Container) Get(instance interface{}, method string) interface{}

Get returns a function for specified method. If you want to specify a method from an interface, you need to use (*ArbitraryInterface)(nil) as instance.

func (*Container) Put

func (c *Container) Put(instance interface{})

Put puts an instance in this container. The instance must have one or more methods.

func (*Container) PutInterface

func (c *Container) PutInterface(iface interface{}, instance interface{})

PutInterface puts an instance in this container. The instance must have one or more methods. The iface should be like (*ArbitraryInterface)(nil).

Jump to

Keyboard shortcuts

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