Container: add WithContainer helper
This commit is contained in:
parent
5d53e32316
commit
f48503f2b6
|
@ -41,3 +41,9 @@ func Must(ctx context.Context) *service.Container {
|
|||
func ServiceContainer(container *service.Container) goweb.Middleware {
|
||||
return middleware.WithValue(KeyServiceContainer, container)
|
||||
}
|
||||
|
||||
// WithContainer returns a new context.Context with the given *service.Container
|
||||
// attached.
|
||||
func WithContainer(ctx context.Context, container *service.Container) context.Context {
|
||||
return context.WithValue(ctx, KeyServiceContainer, container)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue