aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug.go
diff options
context:
space:
mode:
Diffstat (limited to 'bug/bug.go')
-rw-r--r--bug/bug.go24
1 files changed, 15 insertions, 9 deletions
diff --git a/bug/bug.go b/bug/bug.go
index dce30f76..65fb621e 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -42,14 +42,20 @@ func NewBug() *Bug {
}
}
+func simpleResolvers(repo repository.ClockedRepo) entity.Resolvers {
+ return entity.Resolvers{
+ &identity.Identity{}: identity.NewSimpleResolver(repo),
+ }
+}
+
// Read will read a bug from a repository
func Read(repo repository.ClockedRepo, id entity.Id) (*Bug, error) {
- return ReadWithResolver(repo, identity.NewSimpleResolver(repo), id)
+ return ReadWithResolver(repo, simpleResolvers(repo), id)
}
-// ReadWithResolver will read a bug from its Id, with a custom identity.Resolver
-func ReadWithResolver(repo repository.ClockedRepo, identityResolver identity.Resolver, id entity.Id) (*Bug, error) {
- e, err := dag.Read(def, repo, identityResolver, id)
+// ReadWithResolver will read a bug from its Id, with custom resolvers
+func ReadWithResolver(repo repository.ClockedRepo, resolvers entity.Resolvers, id entity.Id) (*Bug, error) {
+ e, err := dag.Read(def, repo, resolvers, id)
if err != nil {
return nil, err
}
@@ -63,22 +69,22 @@ type StreamedBug struct {
// ReadAll read and parse all local bugs
func ReadAll(repo repository.ClockedRepo) <-chan StreamedBug {
- return readAll(repo, identity.NewSimpleResolver(repo))
+ return readAll(repo, simpleResolvers(repo))
}
// ReadAllWithResolver read and parse all local bugs
-func ReadAllWithResolver(repo repository.ClockedRepo, identityResolver identity.Resolver) <-chan StreamedBug {
- return readAll(repo, identityResolver)
+func ReadAllWithResolver(repo repository.ClockedRepo, resolvers entity.Resolvers) <-chan StreamedBug {
+ return readAll(repo, resolvers)
}
// Read and parse all available bug with a given ref prefix
-func readAll(repo repository.ClockedRepo, identityResolver identity.Resolver) <-chan StreamedBug {
+func readAll(repo repository.ClockedRepo, resolvers entity.Resolvers) <-chan StreamedBug {
out := make(chan StreamedBug)
go func() {
defer close(out)
- for streamedEntity := range dag.ReadAll(def, repo, identityResolver) {
+ for streamedEntity := range dag.ReadAll(def, repo, resolvers) {
if streamedEntity.Err != nil {
out <- StreamedBug{
Err: streamedEntity.Err,