Skip to content

wzshiming/inject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inject

Is a simplified dependency injection library

Build Status Go Report Card GoDoc GitHub license gocover.io

Example

package main

import (
	"fmt"
	"reflect"

	"github.com/wzshiming/inject"
)

func main() {

	inj := inject.NewInjector(nil)
	inj.Map(reflect.ValueOf(10))
	inj.Map(reflect.ValueOf("Hello world"))

	inj.Call(reflect.ValueOf(func(i int, s string) {
		fmt.Println(s, i)
		// Hello world 10
	}))

	t := struct {
		I int
		S string
	}{}
	inj.InjectStruct(reflect.ValueOf(&t))
	fmt.Println(t)
	// {10 Hello world}
}

License

Pouch is licensed under the MIT License. See LICENSE for the full license text.

About

Is a simplified dependency injection library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages