goround

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[I any](c *Container) (I, error)

func GetByName

func GetByName(c *Container, name string) (any, error)

func MustGet

func MustGet[I any](c *Container) I

func MustPopulate added in v0.0.2

func MustPopulate[T any](c *Container, target *T, options ...option) *T

MustPopulate is like Populate but panics if injection fails.

func Populate added in v0.0.2

func Populate[T any](c *Container, target *T, options ...option) (*T, error)

Populate injects dependencies into target using the same injection pipeline as Register+Get, but without adding target to c. Because target is never added to c, no other service can receive it as a dependency, and a struct that (transitively) depends on its own type will fail with a "not found" error — unlike Register+Get, which can resolve direct self-cycles because the service is already present in the container before recursion happens.

func Register

func Register[T any](c *Container, empty T, options ...option)

func RegisterBasicValue

func RegisterBasicValue[T any](c *Container, value T)

func WithFunctionInject

func WithFunctionInject(enable bool) option

func WithFunctionInjectName

func WithFunctionInjectName(name string) option

func WithReplacerFunction

func WithReplacerFunction(replacerFunction any) option

func WithStructDefaultInject

func WithStructDefaultInject(enable bool) option

func WithStructInject

func WithStructInject(enable bool) option

func WithStructTag

func WithStructTag(tag string) option

Types

type Container

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

func NewContainer

func NewContainer(defaultOptions ...option) *Container

type PostInject

type PostInject interface {
	PostInject()
}

Jump to

Keyboard shortcuts

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