diff options
author | Michael Muré <batolettre@gmail.com> | 2022-08-13 12:08:48 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-08-18 15:55:48 +0200 |
commit | 45f5f852b71a63c142bca8b05efe53eebf142594 (patch) | |
tree | cb92d9f598b13dda69fbbc652a21d0ad8dc314c2 /bug/resolver.go | |
parent | cd52872475f1b39f3fb6546606c1e78afb6c08e3 (diff) | |
download | git-bug-45f5f852b71a63c142bca8b05efe53eebf142594.tar.gz |
core: generalized resolvers to resolve any entity time when unmarshalling an operation
Diffstat (limited to 'bug/resolver.go')
-rw-r--r-- | bug/resolver.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bug/resolver.go b/bug/resolver.go new file mode 100644 index 00000000..e7beb0e4 --- /dev/null +++ b/bug/resolver.go @@ -0,0 +1,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) +} |