di

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package di a simple dependencies injection

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustResolve

func MustResolve[T any]() T

MustResolve get the value, if not exist create panic

func MustResolveNamed

func MustResolveNamed[T any](name string) T

MustResolveNamed get the value for the name, if not exist create panic

func Provide

func Provide[T any](value T, override bool) bool

Provide save the value and return is it saved

func ProvideLazy

func ProvideLazy[T any](initFunc func() (T, error), override bool) bool

ProvideLazy save the lazy init value and return is it saved

func ProvideNamed

func ProvideNamed(name string, value any, override bool) (ok bool)

ProvideNamed save the value for the name and return is it saved

func Resolve

func Resolve[T any]() (T, error)

Resolve get the value, if not exist returns error

func ResolveNamed

func ResolveNamed[T any](name string) (value T, err error)

ResolveNamed get the value for the name if not exist returns error

Types

This section is empty.

Jump to

Keyboard shortcuts

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