mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-16 12:10:36 +03:00
Clearer way to create definitions
This commit is contained in:
parent
4df6c43be8
commit
b2cdf8cadb
@ -6,10 +6,10 @@ import (
|
||||
"github.com/karlkfi/inject"
|
||||
)
|
||||
|
||||
var (
|
||||
indexRepository repositories.ArtistIndex
|
||||
)
|
||||
func define(ptr interface{}, constructor interface{}, argPtrs ...interface{}) {
|
||||
utils.Graph.Define(ptr, inject.NewProvider(constructor, argPtrs...))
|
||||
}
|
||||
|
||||
func init () {
|
||||
utils.Graph.Define(&indexRepository, inject.NewProvider(repositories.NewArtistIndexRepository))
|
||||
define(new(repositories.ArtistIndex), repositories.NewArtistIndexRepository)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user