Simplified DI resolution

This commit is contained in:
Deluan
2016-03-11 15:16:17 -05:00
parent e9861e1b26
commit f4c1dbdd3c
8 changed files with 12 additions and 22 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"github.com/deluan/gosonic/domain"
"github.com/deluan/gosonic/engine"
"github.com/deluan/gosonic/utils"
"github.com/karlkfi/inject"
)
type GetAlbumListController struct {
@@ -20,7 +19,7 @@ type GetAlbumListController struct {
type strategy func(offset int, size int) (*domain.Albums, error)
func (c *GetAlbumListController) Prepare() {
inject.ExtractAssignable(utils.Graph, &c.listGen)
utils.ResolveDependencies(&c.listGen)
c.types = map[string]strategy{
"random": func(o int, s int) (*domain.Albums, error) { return c.listGen.GetRandom(o, s) },