di

package
v0.0.0-...-0e7c249 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2019 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container contains dependencies by name.

func New

func New() *Container

New creates new Container instance.

func (*Container) Close

func (c *Container) Close()

Close closes all dependencies.

func (*Container) GetByName

func (c *Container) GetByName(name string) interface{}

GetByName returns a dependency by name.

func (*Container) GetByType

func (c *Container) GetByType(typ interface{}) interface{}

GetByType returns a dependency by type.

func (*Container) Provide

func (c *Container) Provide(name string, dependency interface{})

Provide registers a dependency.

func (*Container) Resolve

func (c *Container) Resolve() error

Resolve decorates objects with dependencies and initializes them.

type Dependency

type Dependency interface {
	Open() error
	Close()
}

Jump to

Keyboard shortcuts

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