Releases: matzefriedrich/parsley
parsley v0.8.2
This release introduces the parsley-cli
utility to extend the library's capabilities beyond what reflection alone can achieve and to outpace the limitations of the statically typed language. This version focuses on empowering developers with new tools for code generation, particularly around proxy and decorator patterns.
Changes
New CLI Tool: This version introduces parsley-cli
, a powerful command-line utility designed to enhance the Parsley ecosystem. With this tool, developers can generate code that integrates seamlessly with Parsley’s dependency injection framework.
-
init
Command: Theinit
command bootstraps a new Parsley application, generating essential files such asmain.go
andapplication.go
. These files provide the minimum setup required to kick-start a dependency injection-enabled application. -
generate proxy
Command: Thegenerate proxy
command allows developers to create proxy types that can be extended viaMethodInterceptor
objects. These generated proxies can serve as powerful tools for implementing cross-cutting concerns like logging, monitoring, or transaction management in a clean and modular way.
parsley v0.7.1
This version addresses issues with resolving and injecting services as lists.
Changes
-
Adds the
RegisterList[T]
method to enable the resolver to inject lists of services. While resolving lists of a specific service type was already possible by theResolveRequiredServices[T]
method, the consumption of arrays in constructor functions requires an explicit registration. The list registration can be mixed with named service registrations. -
Adds
fmt.Stringer
implementations to registration types to improve the debugging experience. It also fixes the handling of types reflected from anonymous functions. -
Extracts some registry and resolver errors.
parsley v0.7.0
Changes
- Adds the
RegisterLazy[T]
method to register a lazy service factory. Use the typeLazy[T]
to consume a lazy service dependency and call itsValue() T
method to request the actual service instance. The lazy instance will create and cache the service instance upon the first request. Each subsequent call to theValue
method will return the cached value.
parsley v0.6.1
Changes
- Automatically registers services with a name automatically with the desired lifetime scope to resolve them also as a list of services (like services without a name).
- Changes the resolver so that temporary registrations are selected first (and shadow permanent registrations). The behavior can now generally be leveraged in
ResolverOptionsFunc
as well, to shadow other registrations when resolving instances viaResolveWithOptions.
parsley v0.6.0
Changes
- Registration of named services is now supported; use the
RegisterNamed[T]
method to register a factory for services implementing the same interface and resolve them by name via afunc(string) T
factory method. - The registration and activation of pointer types is now possible (to not enforce interfaces as abstractions).
- Parsley now has a service activation module that can create instances of unregistered types. Use the
Activate[T]
method to invoke a constructor function with resolved dependencies.
Fixes
- This version fixes a bug in the
detectCircularDependency
helper function that could cause the resolver to get stuck in an infinite loop.
parsley v0.5.0
Changes
- The service registry now accepts multiple registrations for the same interface.
- The resolver has been extended to handle multiple service registrations per interface type.
parsley v0.4.0
Changes
- Registration of factory functions is now supported, adding the ability to create instances of services based on input parameters provided at runtime.
- New sub-packages for
registration
andresolving
have been added. Many types that support the package's internal functionality have been moved tointernal
. - Integration tests are moved to the internal package, making it easier to navigate the repository.
parsley v0.3.0
Changes
- Service registrations can be bundled in a
ModuleFunc
to register related types as a unit. - The
ServiceRegistry
now accepts object instances as singleton service registrations. - The
ResolveRequiredService[T]
convenience function can resolve and safe-cast objects. - The resolver instance registers with the registry to inject the
Resolver
object into the factory and constructor methods. - The resolver can now accept instances of non-registered types via the
ResolveWithOptions[T]
method. - The
ServiceRegistry
has new methods for creating linked and scoped registry objects (which share the sameServiceIdSequence
). Scoped registries inherit all parent service registrations, while linked registries are empty.
parsley v0.2.0
Changes
- Registry rejects non-interface types
- The resolver can now detect circular dependencies
Fixes
- Fixes error types
- Fixes non-interface type error