deps

package
v0.0.0-...-4624acb Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

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

Deps provides a way to construct dependencies container, and supports dependency injection.

func NewDeps

func NewDeps() *Deps

NewDeps creates a new Dep instance

func (*Deps) Construct

func (d *Deps) Construct(fn interface{}) (interface{}, error)

Construct takes a function in the form of `func(arg1 Type1, arg2 Type2,...) (ret, error)`. The arguments to the function is automatically filled with the dependency injection functionality.

func (*Deps) Fill

func (d *Deps) Fill(params interface{}) error

Fill injects dependencies from Deps to params

func (*Deps) Provide

func (d *Deps) Provide(constructor interface{}) error

Provide accepts a constructor and build a value into container

Jump to

Keyboard shortcuts

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