Skip to content

Invoke with provided args? #214

Closed
Closed
@rubensayshi

Description

@rubensayshi

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 ( I managed in like 15min by just fiddling in my vendor folder ), which leads me to belief it's not in there for a (good) reason...?

something like;

// my super complicated service
type MyService struct {
	Booyaa bool
}

// provide for my super complicated service
func NewMyService() *MyService {
	return &MyService{}
}

func CanWeBooyaa(ctx *gin.Context, service *MyService) {
	ctx.String(200, fmt.Sprintf("booyaa? %v! \n", service.Booyaa))
}

container := dig.New()
container.Provide(NewMyService)

ctx := &gin.Context{}
container.Invoke(CanWeBooyaa, ctx)

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