Clearer way to create definitions
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user