dig
dig copied to clipboard
A reflection based dependency injection toolkit for Go.
Hi dig maintainers, My organization made an internal tool that has many different startup tasks that all produce a unique Go type. Before dig/fx, some tasks wrote to a shared...
hello. I have such a code ```go container.Provide(func(clientCfg *config.Ignite) database.Db { ignite, err := database.NewIgnite(ctx, clientCfg) if err != nil { logger.Error(fmt.Errorf("container provide error: %w", err)) return nil } else...
Addresses #181 Allows a constructor or invoke to specify the names of dependencies.
m
This implementation allows developers to invoke specific function between multiple containers. This may be useful in case of you have a container instantiated at application startup (singleton container) and a...
Would it be an idea to let `Invoke` take arguments that aren't coming from the container? It seems rather straight forward to add this, which leads me to belief it's...
Currently, we don't get any visibility into the types injected in the DI container of Dig. i.e. it's not really possible to see which constructors' provided types are the "most...
Hello there! Why I can't use dig.As with dig.Group provide option? It would be better if I can write: ``` d.Provide(NewCleanService, dig.Group("cron_job"), dig.As(new(cron.Command))) ``` instead of: ``` d.Provide(NewCleanService) d.Provide(func(service *CleanService)...
``` package main import ( "fmt" "go.uber.org/dig" ) type Animal interface { Say() } type Dog struct { Name string } // NewDog dig provider func NewDog() *Dog { println("new...
I am compelled to ask here but I am unable to find how to test the dig containers and services created by it. There is an unanswered stackoverflow question as...