{"id":16464482,"url":"https://github.com/deatil/go-container","last_synced_at":"2025-07-03T16:35:57.197Z","repository":{"id":254886890,"uuid":"836201817","full_name":"deatil/go-container","owner":"deatil","description":"go-container is a container pkg for go","archived":false,"fork":false,"pushed_at":"2024-08-29T04:35:58.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T15:43:49.841Z","etag":null,"topics":["container","di","go-container","go-di","go-ioc","ioc"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/deatil/go-container","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/deatil.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-07-31T11:07:02.000Z","updated_at":"2024-11-04T12:21:17.000Z","dependencies_parsed_at":"2024-11-11T20:23:53.923Z","dependency_job_id":"936d6a78-4855-4170-a3db-a044235f19ed","html_url":"https://github.com/deatil/go-container","commit_stats":null,"previous_names":["deatil/go-container"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/deatil/go-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fgo-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fgo-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fgo-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fgo-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deatil","download_url":"https://codeload.github.com/deatil/go-container/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deatil%2Fgo-container/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263361220,"owners_count":23454893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["container","di","go-container","go-di","go-ioc","ioc"],"created_at":"2024-10-11T11:27:59.339Z","updated_at":"2025-07-03T16:35:57.171Z","avatar_url":"https://github.com/deatil.png","language":"Go","readme":"## go-container\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/deatil/go-container\" target=\"_blank\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/deatil/go-container.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/deatil/go-container\" target=\"_blank\"\u003e\u003cimg src=\"https://codecov.io/gh/deatil/go-container/graph/badge.svg?token=SS2Z1IY0XL\"/\u003e\u003c/a\u003e\n\u003cimg src=\"https://goreportcard.com/badge/github.com/deatil/go-container\" /\u003e\n\u003c/p\u003e\n\n\n### Desc\n\n*  go-container is a container pkg for go.\n\n[中文](README_CN.md) | English\n\n\n### Download\n\n~~~go\ngo get -u github.com/deatil/go-container\n~~~\n\n\n### Get Starting\n\nglobal use\n~~~go\ndi := container.DI()\n~~~\n\ncustomer use\n~~~go\ndi := container.New()\n~~~\n\n~~~go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/deatil/go-container/container\"\n)\n\ntype testBind struct {}\n\nfunc (t *testBind) Data() string {\n    return \"testBind data\"\n}\n\nfunc main() {\n    // Bind func\n    di := container.DI()\n    di.Bind(\"testBind\", func() *testBind {\n        return \u0026testBind{}\n    })\n    tb := di.Get(\"testBind\")\n\n    tb2, _ := tb.(*testBind)\n    \n    fmt.Printf(\"output: %s\", tb2.Data())\n    // output: testBind data\n}\n\nfunc useProvide() {\n    // use Provide\n    di := container.DI()\n    di.Provide(func() *testBind {\n        return \u0026testBind{}\n    })\n    di.Invoke(func(tb *testBind) {\n        fmt.Printf(\"output: %s\", tb.Data())\n        // output: testBind data\n    })\n}\n\n~~~\n\n\n### LICENSE\n\n*  The library LICENSE is `Apache2`, using the library need keep the LICENSE.\n\n\n### Copyright\n\n*  Copyright deatil(https://github.com/deatil).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeatil%2Fgo-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeatil%2Fgo-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeatil%2Fgo-container/lists"}