{"repo":"sarulabs/di","free":true,"listed":false,"github":"https://github.com/sarulabs/di","clone":"git clone https://github.com/sarulabs/di.git","description":"Dependency injection container in go (golang)","language":"Go","stars":723,"topics":["golang","go","dependency-injection","container","di","framework"],"license":"MIT","category":"deployment-docker-iac","readme_excerpt":"Dependency injection framework for go programs (golang). DI handles the life cycle of the objects in your application. It creates them when they are needed, resolves their dependencies, and closes them properly when they are no longer used. If you do not know if DI could help improve your application, learn more about dependency injection and dependency injection containers: - What is a dependency injection container and why use one ? There is also an Examples section at the end of the documentation. DI is focused on performance. Table of contents - Basic usage - Builder EnhancedBuilder usage EnhancedBuilder limitations - Definitions Definition Build function Definition dependencies Definition name Definition for an already built object Unshared definitions Definition Close function Definition types Definition tags - Object retrieval Get SafeGet Fill - Scopes The principle Scopes in practice Scopes and dependencies Container deletion Unscoped retrieval - HTTP helpers - Examples - Performance Basic usage A definition contains at least a Build function to create the object. The definition can be added to a builder with the Add method: Once all the definitions are added to the Builder, you can call the Build method to generate a Container . Objects can then be retrieved from the container: The Get method returns an interface{} . You need to cast the interface before using the object. The container will only call the definition Build function the first time the Get method is call","default_branch":null,"files":null,"tree":[],"storefront":"/r/sarulabs","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sarulabs/di/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}