Clearer way to create definitions
This commit is contained in:
parent
4df6c43be8
commit
b2cdf8cadb
1 changed files with 4 additions and 4 deletions
|
|
@ -6,10 +6,10 @@ import (
|
||||||
"github.com/karlkfi/inject"
|
"github.com/karlkfi/inject"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
func define(ptr interface{}, constructor interface{}, argPtrs ...interface{}) {
|
||||||
indexRepository repositories.ArtistIndex
|
utils.Graph.Define(ptr, inject.NewProvider(constructor, argPtrs...))
|
||||||
)
|
}
|
||||||
|
|
||||||
func init () {
|
func init () {
|
||||||
utils.Graph.Define(&indexRepository, inject.NewProvider(repositories.NewArtistIndexRepository))
|
define(new(repositories.ArtistIndex), repositories.NewArtistIndexRepository)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue