Skip to content

Ability to combine multiple containers #229

@maciej

Description

@maciej

Hi,

I'd like to be able to combine multiple containers together. Instead of having a single container assembled within the main function I'd like to have one for each package and them combine them in main().
Currently I have to export every constructor or provider function to have it accessible from where I want to build the container. That's not great. I'd like some of those constructors to be package-private.
I believe there is currently no way to achieve that in dig, but please correct me if I'm wrong!

I'm inspired by Guice's modules https://github.com/google/guice/wiki/GettingStarted. Guice's users were encouraged to have a single "module" (a similar construct to the container) for every package. Modules would we later assembled when creating the "injector".

Do you think such a feature would make sense for dig?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions