Miscellaneous
Parsley is a reflection-based dependency injection (DI) package for Go that streamlines dependency management through automated lifetime management, type-safe registration, service resolution and activation, proxy generation, and method interception. It leverages reflection only at startup, ensuring runtime efficiency, and supports features like mocking and testing integration for better development workflows.
Dependency injection in Go typically relies on constructor functions, which are idiomatic and foundational for creating and managing dependencies. While this approach is powerful, it can lead to boilerplate code as projects become more complex, requiring explicit instantiation and manual wiring. Addionally, more sophisticated ramp-up code is needed, if not all instances shall be created at application start. Parsley eliminates much of this repetitive code by automating the creation and wiring of dependencies, enabling developers to focus on application logic. It aims to enhance modularity and make managing dependencies easier.
Lazy[T]
.For a complete overview of features and capabilities, refer to the Parsley documentation.
Add Parsley to your project:
go get github.com/matzefriedrich/parsley
For advanced features like proxy generation or mock creation, install the parsley-cli
utility:
go install github.com/matzefriedrich/parsley/cmd/parsley-cli
Copyright 2024 - Matthias Friedrich