All Projects → teou → Inji

teou / Inji

Licence: mit
a dependency inject container for golang (golang inject), objects will be closed on a reverse order of their creation

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Inji

Tsyringe
Lightweight dependency injection container for JavaScript/TypeScript
Stars: ✭ 2,761 (+21138.46%)
Mutual labels:  dependency, dependency-injection
Dikit
Dependency Injection Framework for Swift, inspired by KOIN.
Stars: ✭ 77 (+492.31%)
Mutual labels:  dependency, dependency-injection
Container Ioc
Inversion of Control container & Dependency Injection for Javascript and Node.js apps powered by Typescript.
Stars: ✭ 89 (+584.62%)
Mutual labels:  dependency, dependency-injection
Mimick.Fody
An integrated framework for dependency injection and aspect-oriented processing.
Stars: ✭ 15 (+15.38%)
Mutual labels:  dependency-injection, dependency
Kodein Mvvm
Example app using Kodein for dependency injection with MVVM and Architecture Components
Stars: ✭ 26 (+100%)
Mutual labels:  dependency, dependency-injection
Zenject-2019
Dependency Injection Framework for Unity3D
Stars: ✭ 2,567 (+19646.15%)
Mutual labels:  dependency-injection, dependency
DependencyInjector
Lightweight dependency injector
Stars: ✭ 30 (+130.77%)
Mutual labels:  dependency-injection, dependency
siringa
Minimalist dependency injection library for Python that embraces type annotations syntax
Stars: ✭ 51 (+292.31%)
Mutual labels:  dependency-injection, dependency
Di
DI: C++14 Dependency Injection Library
Stars: ✭ 756 (+5715.38%)
Mutual labels:  dependency-injection
Inherited builder
🤖Autogenerated state management and dependency injection with inherited widgets
Stars: ✭ 17 (+30.77%)
Mutual labels:  dependency-injection
Opulence
A simple, secure, and scalable PHP application framework
Stars: ✭ 723 (+5461.54%)
Mutual labels:  dependency-injection
Tslib
Runtime library for TypeScript helpers.
Stars: ✭ 762 (+5761.54%)
Mutual labels:  dependency
Grpc
A proof of concept for a way to implement gRPC services in a code first way using C# and .NET Core.
Stars: ✭ 17 (+30.77%)
Mutual labels:  dependency-injection
Go Spring
基于 IoC 的 Go 后端一站式开发框架 🚀
Stars: ✭ 744 (+5623.08%)
Mutual labels:  dependency-injection
Snowball
Android Clean Code Sample Project
Stars: ✭ 26 (+100%)
Mutual labels:  dependency-injection
Apk Dependency Graph
Android class dependency visualizer. This tool helps to visualize the current state of the project.
Stars: ✭ 675 (+5092.31%)
Mutual labels:  dependency-injection
Container
Small but powerful dependency injection container
Stars: ✭ 674 (+5084.62%)
Mutual labels:  dependency-injection
Anakin
This Node module maps all application's dependencies and centralizes everything, at only one place
Stars: ✭ 8 (-38.46%)
Mutual labels:  dependency-injection
Swiftresolver
Dependency injection framework for Swift
Stars: ✭ 26 (+100%)
Mutual labels:  dependency-injection
Marvelheroes
❤️ A sample Marvel heroes application based on MVVM (ViewModel, Coroutines, LiveData, Room, Repository, Koin) architecture.
Stars: ✭ 826 (+6253.85%)
Mutual labels:  dependency-injection

Build Status codecov

inji

  • a dependency injection container for golang.
  • auto store and register objects into a graph.
  • struct pointer dependency will be auto created if not found in graph.
  • when closing graph, every object will be closed on a reverse order of their creation.

use


package main

import (
	"fmt"

	"github.com/teou/inji"
)

type Test struct {
	Target int `inject:"target"`
}

func (t *Test) Start() error {
	fmt.Println("start", t.Target)
	return nil
}

func (t *Test) Close() {
	fmt.Println("close", t.Target)
}

type Dep struct {
	Test *Test `inject:"test"`
}

func (d *Dep) Close() {
	fmt.Println("close Dep", d.Test)
}

func main() {
	inji.InitDefault()
	//dep.Close, test.Close will be called orderly
	defer inji.Close()
	inji.Reg("target", 123)
	//test will be auto created, test.Start will be called, then dep.Start(if any)
	dep := inji.Reg("dep", (*Dep)(nil)).(*Dep)
	fmt.Println("find dep", dep)
}

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].