aboutsummaryrefslogtreecommitdiffstats
path: root/identity/resolver.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-09-16 16:22:02 +0200
committerMichael Muré <batolettre@gmail.com>2020-10-04 20:39:10 +0200
commitca720f165cb286d4372ad48595e532a2423f2f07 (patch)
tree6e1496a1a6603abbd473cc0060a5acebc763a68b /identity/resolver.go
parentd56ce3d5d9f5ef74201a8ee7c25be4820d435b47 (diff)
downloadgit-bug-ca720f165cb286d4372ad48595e532a2423f2f07.tar.gz
cache,bug,identity: structural change
- bug doesn't commit identities anymore, only make sure they are commit - cache use an IdentityResolver to load bugs with identities from the cache (deps injection) - IdentityCache now are identity.Interface
Diffstat (limited to 'identity/resolver.go')
-rw-r--r--identity/resolver.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/identity/resolver.go b/identity/resolver.go
index 70fac74c..ab380a12 100644
--- a/identity/resolver.go
+++ b/identity/resolver.go
@@ -11,7 +11,7 @@ type Resolver interface {
ResolveIdentity(id entity.Id) (Interface, error)
}
-// DefaultResolver is a Resolver loading Identities directly from a Repo
+// SimpleResolver is a Resolver loading Identities directly from a Repo
type SimpleResolver struct {
repo repository.Repo
}
@@ -23,3 +23,14 @@ func NewSimpleResolver(repo repository.Repo) *SimpleResolver {
func (r *SimpleResolver) ResolveIdentity(id entity.Id) (Interface, error) {
return ReadLocal(r.repo, id)
}
+
+// StubResolver is a Resolver that doesn't load anything, only returning IdentityStub instances
+type StubResolver struct{}
+
+func NewStubResolver() *StubResolver {
+ return &StubResolver{}
+}
+
+func (s *StubResolver) ResolveIdentity(id entity.Id) (Interface, error) {
+ return &IdentityStub{id: id}, nil
+}