{"id":37179689,"url":"https://github.com/vlorc/gioc","last_synced_at":"2026-01-14T20:54:27.602Z","repository":{"id":54399801,"uuid":"93588029","full_name":"vlorc/gioc","owner":"vlorc","description":"golang ioc framework","archived":false,"fork":false,"pushed_at":"2021-02-20T13:36:21.000Z","size":230,"stargazers_count":33,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T02:05:47.532Z","etag":null,"topics":["factory","go","golang-library","inject","ioc","register"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vlorc.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}},"created_at":"2017-06-07T03:22:17.000Z","updated_at":"2024-06-19T02:05:47.533Z","dependencies_parsed_at":"2022-08-13T14:30:57.922Z","dependency_job_id":null,"html_url":"https://github.com/vlorc/gioc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vlorc/gioc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlorc%2Fgioc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlorc%2Fgioc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlorc%2Fgioc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlorc%2Fgioc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vlorc","download_url":"https://codeload.github.com/vlorc/gioc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vlorc%2Fgioc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["factory","go","golang-library","inject","ioc","register"],"created_at":"2026-01-14T20:54:26.799Z","updated_at":"2026-01-14T20:54:27.590Z","avatar_url":"https://github.com/vlorc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Gioc](https://github.com/vlorc/gioc)\n\n[简体中文](https://github.com/vlorc/gioc/blob/master/README_CN.md)\n\n[![License](https://img.shields.io/:license-apache-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![codebeat badge](https://codebeat.co/badges/c41b426c-4121-4dc8-99c2-f1b60574be64)](https://codebeat.co/projects/github-com-vlorc-gioc-master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/vlorc/gioc)](https://goreportcard.com/report/github.com/vlorc/gioc)\n[![GoDoc](https://godoc.org/github.com/vlorc/gioc?status.svg)](https://godoc.org/github.com/vlorc/gioc)\n[![Build Status](https://travis-ci.org/vlorc/gioc.svg?branch=master)](https://travis-ci.org/vlorc/gioc)\n[![Coverage Status](https://coveralls.io/repos/github/vlorc/gioc/badge.svg?branch=master)](https://codecov.io/gh/vlorc/gioc)\n\ngioc is a lightweight Ioc framework,it provides register and factory and depend solution\n\n## Features\n\n* Dependency Resolve\n* Dependency Inject\n* Singleton/Transient Support\n* Custom Tag\n* Invoker Support\n* [Lazy](https://github.com/vlorc/gioc/blob/master/examples/lazy/main.go) Load\n* [Struct](https://github.com/vlorc/gioc/blob/master/examples/depend/main.go) Extends Support\n* [Condition](https://github.com/vlorc/gioc/blob/master/examples/cond/main.go) Support\n* [Module](https://github.com/vlorc/gioc/blob/master/examples/module/main.go) Support\n\n## Installing\n\n\tgo get -u github.com/vlorc/gioc\n\n## Quick Start\n\n* Create Root Module\n\n```golang\ngioc.NewRootModule()\n```\n\n* Import Module\n\n```golang\nNewModuleFactory(\n    Import(\n        ConfigModule,\n        ServerModule,\n    )\n)\n```\n\n* Declare Instance\n\n```golang\nNewModuleFactory(\n    Declare(\n        Instance(1), Id(\"id\"),\n        Instance(\"ioc\"), Id(\"name\"),\n    ),\n)\n```\n\n* Export Instance\n\n```golang\nNewModuleFactory(\n    Export(\n        Instance(1), Id(\"id\"),\n        Instance(\"ioc\"), Id(\"name\"),\n    ),\n)\n```\n\n* Condition Import\n\n```golang\nNewModuleFactory(\n    Condition(\n    \tHavingValue(Equal(\"redis\"), types.StringType, \"cache.type\"), \n    \tImport(RedisModule),\n    ),\n    Condition(\n        Or(\n            Not(HavingBean(types.StringType, \"cache.type\")),\n            HavingValue(Equal(\"memory\"), types.StringType, \"cache.type\"),\n        ), \n        Import(MemoryModule),\n    ),\n)\n```\n\n## Examples\n\n* Basic Module\n\n```golang\nimport (\n    .\"github.com/vlorc/gioc\"\n    .\"github.com/vlorc/gioc/module\"\n    .\"github.com/vlorc/gioc/module/operation\"\n)\n\n// config.go\nvar ConfigModule = NewModuleFactory(\n    Export(\n        Mapping(map[string]interface{}{\n            \"id\": 1,\n            \"name\": \"ioc\",\n        }),\n    ),\n)\n\n// main.go\nfunc main() {\n    NewRootModule(\n        Import(ConfigModule),\n        Bootstrap(func(param struct{ id int; name string }) {\n            println(\"id: \", param.id, \" name: \",param.name)\n        }),\n    )\n}\n```\n\n## License\n\nThis project is under the apache License. See the LICENSE file for the full license text.\n\n## Interface\n\n+ Provider\n    + provides Factory discovery\n+ Factory\n    + responsible for generating Instance\n    + the basic plant has a value factory, method factory, agent factory, single factory, type factory\n+ Register\n    + as a connection to Factory and Selector\n    + provides the registration method, which eventually matches the Type to the Factory\n+ Dependency\n    + for target type dependency analysis, collection integration\n    + converted to an Injector by an instance\n+ Container\n    + provides Register and Provider, and the parent container makes up traversal\n    + convert to read-only Provider\n    + convert to seal Container\n+ Selector\n    + find factory by type and name\n+ Module\n    + import module\n    + export factory\n    + declare factory\n\n# Roadmap\n\nFor details on planned features and future direction please refer\nto [roadmap](https://github.com/vlorc/gioc/blob/master/ROADMAP.md)\n\n# Keyword\n\n**dependency injection, inversion of control**\n\n# Reference\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlorc%2Fgioc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvlorc%2Fgioc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvlorc%2Fgioc/lists"}