Documentation
¶
Overview ¶
Package scope provides lifecycle management strategies for the IoC container. To add a custom lifecycle, implement the Scope interface in a new file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpRequestScope ¶
type HttpRequestScope struct {
// contains filtered or unexported fields
}
HttpRequestScope creates one instance per HTTP request. Distinct requests each get their own independent instance.
The unexported _ byte field makes this a non-zero-size struct. Without it, Go would point all instances to runtime.zerobase, making every *HttpRequestScope identical as a map key and causing different bindings to collide in the RequestScopeStore.
func NewHttpRequestScope ¶
func NewHttpRequestScope() *HttpRequestScope
NewHttpRequestScope creates an HttpRequestScope. Each call returns a pointer with a unique address, used as the store key.
type PrototypeScope ¶
type PrototypeScope struct{}
PrototypeScope creates a new instance on every Resolve call.
func NewPrototypeScope ¶
func NewPrototypeScope() *PrototypeScope
NewPrototypeScope creates a PrototypeScope.
type RequestScopeStore ¶
type RequestScopeStore struct {
// contains filtered or unexported fields
}
RequestScopeStore caches instances created by HttpRequestScope for a single HTTP request.
type SingletonScope ¶
type SingletonScope struct {
// contains filtered or unexported fields
}
SingletonScope creates exactly one instance for the lifetime of the application.
func NewSingletonScope ¶
func NewSingletonScope() *SingletonScope
NewSingletonScope creates a SingletonScope.