#
resolving
import "github.com/matzefriedrich/parsley/pkg/resolving"
#
Index
func Activate[T any](ctx context.Context, resolver types.Resolver, activatorFunc any, options ...types.ResolverOptionsFunc) (T, error) func NewResolver(registry types.ServiceRegistry) types.Resolver func NewScopedContext(ctx context.Context) context.Context func ResolveRequiredService[T any](ctx context.Context, resolver types.Resolver) (T, error) func ResolveRequiredServices[T any](ctx context.Context, resolver types.Resolver) ([]T, error) func WithInstance[T any](instance T) types.ResolverOptionsFunc type NamedServiceResolverActivatorFunc func CreateNamedServiceResolverActivatorFunc[T any](ctx context.Context) NamedServiceResolverActivatorFunc[T]
#
func Activate
func Activate[T any](ctx context.Context, resolver types.Resolver, activatorFunc any, options ...types.ResolverOptionsFunc) (T, error)
Activate attempts to create and return an instance of the requested type using the provided resolver. Use this method to instantiate service objects of unregistered types. The specified activator function can have parameters to demand service instances for registered service types.
#
func NewResolver
func NewResolver(registry types.ServiceRegistry) types.Resolver
NewResolver creates and returns a new Resolver instance based on the provided ServiceRegistry.
#
func NewScopedContext
func NewScopedContext(ctx context.Context) context.Context
NewScopedContext creates a new context with an associated service instance map, useful for managing service lifetimes within scope.
#
func ResolveRequiredService
func ResolveRequiredService[T any](ctx context.Context, resolver types.Resolver) (T, error)
ResolveRequiredService resolves a single service instance of the specified type using the given resolver and context. The method can return the following errors: ErrorCannotResolveService, ErrorAmbiguousServiceInstancesResolved.
#
func ResolveRequiredServices
func ResolveRequiredServices[T any](ctx context.Context, resolver types.Resolver) ([]T, error)
ResolveRequiredServices resolves all registered services of a specified type T using the given resolver and context.
#
func WithInstance
func WithInstance[T any](instance T) types.ResolverOptionsFunc
WithInstance Creates a ResolverOptionsFunc that registers a specific instance of a type T with a service registry to be resolved as a singleton.
#
type NamedServiceResolverActivatorFunc
NamedServiceResolverActivatorFunc defines a function for resolving named services.
type NamedServiceResolverActivatorFunc[T any] func(types.Resolver) func(string) (T, error)
#
func CreateNamedServiceResolverActivatorFunc
func CreateNamedServiceResolverActivatorFunc[T any](ctx context.Context) NamedServiceResolverActivatorFunc[T]
CreateNamedServiceResolverActivatorFunc creates a NamedServiceResolverActivatorFunc for resolving named services.