{"id":16800210,"url":"https://github.com/abiosoft/injekt","last_synced_at":"2025-03-17T05:21:06.209Z","repository":{"id":57604615,"uuid":"65804762","full_name":"abiosoft/injekt","owner":"abiosoft","description":"Pluggable service injector","archived":false,"fork":false,"pushed_at":"2016-08-16T21:23:20.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-23T14:51:15.353Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abiosoft.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":"2016-08-16T09:05:16.000Z","updated_at":"2018-08-22T12:14:33.000Z","dependencies_parsed_at":"2022-09-26T20:01:09.414Z","dependency_job_id":null,"html_url":"https://github.com/abiosoft/injekt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Finjekt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Finjekt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Finjekt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abiosoft%2Finjekt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abiosoft","download_url":"https://codeload.github.com/abiosoft/injekt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976361,"owners_count":20377691,"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":[],"created_at":"2024-10-13T09:31:32.192Z","updated_at":"2025-03-17T05:21:06.181Z","avatar_url":"https://github.com/abiosoft.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# injekt\n\nPluggable service injector\n\n[![GoDoc](https://godoc.org/github.com/abiosoft/injekt?status.svg)](https://godoc.org/github.com/abiosoft/injekt)\n[![Build Status](https://travis-ci.org/abiosoft/injekt.svg?branch=master)](https://travis-ci.org/abiosoft/injekt)\n[![Go Report Card](https://goreportcard.com/badge/github.com/abiosoft/injekt)](https://goreportcard.com/report/github.com/abiosoft/injekt)\n[![Coverage Status](https://coveralls.io/repos/github/abiosoft/injekt/badge.svg?branch=master)](https://coveralls.io/github/abiosoft/injekt?branch=master)\n\n\nInjekt is a pluggable service injector for any project or framework. \nInjekt adds service injection support by wrapping a custom function (with services as parameters) with the required function.\n\n### Usage (http Handler example)\nWrite custom function. `session` will be injected as well as specified parameters of the required function.\n```go\nfunc sessionInfo(w http.ResponseWriter, session *Session) {\n    if session == nil { \n        // show login page\n     }\n     ...\n}\n```\nWrap custom function. This returns an `interface{}` that can be asserted to the required function type.\n```go\nfunc main(){\n    var h http.HandlerFunc\n    inj := injekt.New(h)\n    ...\n    http.HandleFunc(\"/\", inj.Wrap(sessionInfo).(http.HandlerFunc))\n}\n```\nRegister services before function is executed.\n```go\nsession := ...\ninj.Register(session)\n```\nSimple and useful.\nCheck the [docs](https://godoc.org/github.com/abiosoft/injekt) for more.\n\n### License\nApache 2","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabiosoft%2Finjekt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabiosoft%2Finjekt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabiosoft%2Finjekt/lists"}