aboutsummaryrefslogtreecommitdiffstats
path: root/entities/bug/resolver.go
blob: e7beb0e481cf03fe06b5b67c61c04ae14bf58ee8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package bug

import (
	"github.com/MichaelMure/git-bug/entity"
	"github.com/MichaelMure/git-bug/repository"
)

var _ entity.Resolver = &SimpleResolver{}

// SimpleResolver is a Resolver loading Bugs directly from a Repo
type SimpleResolver struct {
	repo repository.ClockedRepo
}

func NewSimpleResolver(repo repository.ClockedRepo) *SimpleResolver {
	return &SimpleResolver{repo: repo}
}

func (r *SimpleResolver) Resolve(id entity.Id) (entity.Interface, error) {
	return Read(r.repo, id)
}