MCPcopy Index your code
hub / github.com/git-bug/git-bug / Read

Function Read

entity/dag/entity.go:62–70  ·  view source on GitHub ↗

Read will read and decode a stored local Entity from a repository

(def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, id entity.Id)

Source from the content-addressed store, hash-verified

60
61// Read will read and decode a stored local Entity from a repository
62func Read[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, id entity.Id) (EntityT, error) {
63 if err := id.Validate(); err != nil {
64 return *new(EntityT), errors.Wrap(err, "invalid id")
65 }
66
67 ref := fmt.Sprintf("refs/%s/%s", def.Namespace, id.String())
68
69 return read[EntityT](def, wrapper, repo, resolvers, ref)
70}
71
72// readRemote will read and decode a stored remote Entity from a repository
73func readRemote[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, id entity.Id) (EntityT, error) {

Callers 5

TestWriteReadFunction · 0.70
TestMergeFunction · 0.70
TestRemoveFunction · 0.70
TestRemoveAllFunction · 0.70

Calls 2

ValidateMethod · 0.65
StringMethod · 0.65

Tested by 5

TestWriteReadFunction · 0.56
TestMergeFunction · 0.56
TestRemoveFunction · 0.56
TestRemoveAllFunction · 0.56