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)
| 60 | |
| 61 | // Read will read and decode a stored local Entity from a repository |
| 62 | func 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 |
| 73 | func readRemote[EntityT entity.Interface](def Definition, wrapper func(e *Entity) EntityT, repo repository.ClockedRepo, resolvers entity.Resolvers, remote string, id entity.Id) (EntityT, error) { |