di

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 6 Imported by: 0

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 is a dependency injection container.

func New

func New() *Container

New create new container.

func (*Container) Cleanup

func (c *Container) Cleanup()

Cleanup

func (*Container) Compile

func (c *Container) Compile()

Compile compiles the container. It iterates over all nodes in graph and register their parameters.

func (*Container) Extract

func (c *Container) Extract(params ExtractParams) error

Extract

func (*Container) Provide

func (c *Container) Provide(params ProvideParams)

Provide adds constructor into container with parameters.

type ExtractParams

type ExtractParams struct {
	Name   string
	Target interface{}
}

ExtractParams

type Extractor

type Extractor interface {
	Extract(params ExtractParams) error
}

Extractor

type Parameter

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

Parameter

type ParameterBag

type ParameterBag map[string]interface{}

Parameters

func (ParameterBag) RequireString

func (b ParameterBag) RequireString(key string) string

String

type ProvideParams

type ProvideParams struct {
	Name        string
	Provider    interface{}
	Interfaces  []interface{}
	Parameters  ParameterBag
	IsPrototype bool
}

ProvideParams is a `Provide()` method options. Name is a unique identifier of type instance. Provider is a constructor function. Interfaces is a interface that implements a provider result type.

Directories

Path Synopsis
internal
dag

Jump to

Keyboard shortcuts

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