{"id":13413454,"url":"https://github.com/firasdarwish/ore","last_synced_at":"2026-01-17T09:01:37.463Z","repository":{"id":223020109,"uuid":"758991724","full_name":"firasdarwish/ore","owner":"firasdarwish","description":"Lightweight, generic \u0026 simple dependency injection (DI) container for Go","archived":false,"fork":false,"pushed_at":"2024-10-28T12:44:03.000Z","size":50,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-31T09:49:15.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firasdarwish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-17T17:06:52.000Z","updated_at":"2024-10-28T12:27:19.000Z","dependencies_parsed_at":"2024-11-09T10:19:53.028Z","dependency_job_id":"4e88d4b3-c03b-43c8-a2ea-029df436b333","html_url":"https://github.com/firasdarwish/ore","commit_stats":null,"previous_names":["firasdarwish/ore"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/firasdarwish/ore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firasdarwish%2Fore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firasdarwish%2Fore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firasdarwish%2Fore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firasdarwish%2Fore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firasdarwish","download_url":"https://codeload.github.com/firasdarwish/ore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firasdarwish%2Fore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504596,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:01:40.765Z","updated_at":"2026-01-17T09:01:37.303Z","avatar_url":"https://github.com/firasdarwish.png","language":"Go","funding_links":[],"categories":["杂项","Miscellaneous","Microsoft Office"],"sub_categories":["依赖注入","Dependency Injection"],"readme":"# Ore: A Lightweight Dependency Injection Container for Go\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/firasdarwish/ore.svg)](https://pkg.go.dev/github.com/firasdarwish/ore)\n[![Go Report Card](https://goreportcard.com/badge/github.com/firasdarwish/ore)](https://goreportcard.com/report/github.com/firasdarwish/ore)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go?tab=readme-ov-file#dependency-injection)\n[![codecov](https://codecov.io/gh/firasdarwish/ore/graph/badge.svg?token=ISZVCCYGCR)](https://codecov.io/gh/firasdarwish/ore)\n\n\n![ore](https://ore.lilury.com/img/ore-gopher.png)\n\n\u003cbr /\u003e\n\n**Ore** is a powerful and flexible **Dependency Injection (DI)** library for Go, designed to simplify complex\napplication structures while maintaining performance and modularity.\n\n# 🌐 **[Full Documentation: ore.lilury.com](https://ore.lilury.com)**\n\n---\n\n## Key Features\n\n### 1. **Flexible Lifetime Management**\n\n- **Singletons**: Lifetime spans the entire application.\n- **Scoped**: Lifetime is tied to a specific context.\n- **Transient**: New instance created on every resolution.\n\n---\n\n### 2. **Alias Support**\n\n- Link multiple implementations to the same interface.\n- Easily resolve the preferred implementation or retrieve all registered options.\n\n---\n\n### 3. **Graceful Termination**\n\n- **Application Termination**: Shutdown all resolved singletons implementing `Shutdowner` in proper dependency order.\n- **Context Termination**: Dispose all resolved scoped instances implementing `Disposer` when the context ends.\n\n---\n\n### 4. **Placeholder Registration**\n\n- Register incomplete dependencies at application setup.\n- Provide runtime values dynamically when requests or events occur.\n\n---\n\n### 5. **Multiple Containers (Modules)**\n\n- Create isolated dependency graphs for modular applications.\n- Enforce module boundaries by separating service registrations and resolutions per container.\n\n---\n\n### 6. **Advanced Dependency Validation**\n\n- Detect and prevent common pitfalls like:\n    - **Missing Dependencies**: Ensure all resolvers are registered.\n    - **Circular Dependencies**: Avoid infinite loops in dependency resolution.\n    - **Lifetime Misalignment**: Catch improper lifetime dependencies (e.g., singleton depending on transient).\n\n---\n\n### 7. **Keyed and Keyless Registration**\n\n- Support for multiple instances of the same type, scoped by keys.\n- Easily resolve services using keys to manage module-specific configurations.\n\n---\n\n### 8. **Runtime Value Injection**\n\n- Inject dependencies dynamically during runtime, tailored to request context or user data.\n\n---\n\n### 9. **Context-Based Dependency Resolution**\n\n- Dependencies can be tied to a specific `context.Context`.\n- Automatic cleanup of scoped services when the context ends.\n\n---\n\n## Installation\n\n```bash\ngo get -u github.com/firasdarwish/ore\n```\n\n### Quick Example\n\n```go\npackage main\n\nimport (\n  \"context\"\n  \"fmt\"\n  \"github.com/firasdarwish/ore\"\n)\n\n// Define a service\ntype MyService struct {\n  Message string\n}\n\nfunc main() {\n  // Register a singleton service\n  ore.RegisterSingleton[SomeServiceInterface](\u0026MyService{Message: \"Hello, Ore!\"})\n  \n  // Resolve the service\n  service, _ := ore.Get[*SomeServiceInterface](context.Background())\n  fmt.Println(service.Message) // Output: Hello, Ore!\n}\n```\n\nFor complete usage examples and advanced configurations, visit the **[Ore Documentation](https://ore.lilury.com)**.\n\n\u003cbr /\u003e\n\n## 👤 Contributors\n\n![Contributors](https://contrib.rocks/image?repo=firasdarwish/ore)\n\n\u003cbr /\u003e\n\n## Contributing\n\nFeel free to contribute by opening issues, suggesting features, or submitting pull requests. We welcome your feedback\nand contributions.\n\n\u003cbr /\u003e\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirasdarwish%2Fore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirasdarwish%2Fore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirasdarwish%2Fore/lists"}