di

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 8 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) Invoke added in v2.2.0

func (c *Container) Invoke(params InvokeParams) error

Invoke calls provided function.

func (*Container) Provide

func (c *Container) Provide(params ProvideParams)

Provide adds constructor into container with parameters.

type ErrParameterProvideFailed added in v2.2.2

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

ErrParameterProvideFailed

func (ErrParameterProvideFailed) Error added in v2.2.2

type ErrParameterProviderNotFound added in v2.2.2

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

ErrParameterProviderNotFound

func (ErrParameterProviderNotFound) Error added in v2.2.2

type ExtractParams

type ExtractParams struct {
	Name   string
	Target interface{}
}

ExtractParams

type Extractor

type Extractor interface {
	Extract(params ExtractParams) error
}

Extractor

type Graph added in v2.1.0

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

Graph

func (*Graph) String added in v2.1.0

func (g *Graph) String() string

func (*Graph) WriteTo added in v2.1.0

func (g *Graph) WriteTo(writer io.Writer)

type InvokeParams added in v2.2.0

type InvokeParams struct {
	// The function
	Fn interface{}
}

InvokeParams

type Parameter

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

Parameter

type ParameterBag

type ParameterBag map[string]interface{}

Parameters

func (ParameterBag) Exists added in v2.0.1

func (b ParameterBag) Exists(key string) bool

Exists

func (ParameterBag) Float64 added in v2.0.1

func (b ParameterBag) Float64(key string) (float64, bool)

Float64

func (ParameterBag) Get added in v2.0.1

func (b ParameterBag) Get(key string) (interface{}, bool)

Get

func (ParameterBag) Int added in v2.0.1

func (b ParameterBag) Int(key string) (int, bool)

Int

func (ParameterBag) Int64 added in v2.0.1

func (b ParameterBag) Int64(key string) (int64, bool)

Int64

func (ParameterBag) Require added in v2.0.1

func (b ParameterBag) Require(key string) interface{}

Require

func (ParameterBag) RequireFloat64 added in v2.0.1

func (b ParameterBag) RequireFloat64(key string) float64

RequireFloat64

func (ParameterBag) RequireInt added in v2.0.1

func (b ParameterBag) RequireInt(key string) int

RequireInt

func (ParameterBag) RequireInt64 added in v2.0.1

func (b ParameterBag) RequireInt64(key string) int64

RequireInt64

func (ParameterBag) RequireString

func (b ParameterBag) RequireString(key string) string

RequireString

func (ParameterBag) String added in v2.0.1

func (b ParameterBag) String(key string) (string, bool)

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