Documentation
¶
Overview ¶
Package provider implements lazy initialization and validation for service instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider[T any, K Validatable] struct { // contains filtered or unexported fields }
Provider manages lazy initialization of service instances with validation support. It ensures thread-safe, single initialization using sync.Once.
func New ¶
func New[T any, K Validatable]( factory func(cfg K) (T, error), cfg K, validationContext validation.Context, ) *Provider[T, K]
New creates a Provider with the given factory function, configuration, and validation context. The factory is called lazily on the first Get() invocation.
type Validatable ¶
type Validatable interface {
Validate(validation.Context) error
}
Validatable defines the interface for configuration types that can be validated.
Click to show internal directories.
Click to hide internal directories.