MCPcopy Create free account
hub / github.com/git-bug/git-bug / Resolve

Function Resolve

entity/resolver.go:24–37  ·  view source on GitHub ↗

Resolve use the appropriate sub-resolver for the given type and find the Entity matching the Id.

(rs Resolvers, id Id)

Source from the content-addressed store, hash-verified

22
23// Resolve use the appropriate sub-resolver for the given type and find the Entity matching the Id.
24func Resolve[T Resolved](rs Resolvers, id Id) (T, error) {
25 var zero T
26 for t, resolver := range rs {
27 switch t.(type) {
28 case T:
29 val, err := resolver.(Resolver).Resolve(id)
30 if err != nil {
31 return zero, err
32 }
33 return val.(T), nil
34 }
35 }
36 return zero, fmt.Errorf("unknown type to resolve")
37}
38
39var _ Resolver = &CachedResolver{}
40

Callers 2

operationUnmarshalerFunction · 0.92
unmarshallPackFunction · 0.92

Calls 2

ErrorfMethod · 0.80
ResolveMethod · 0.65

Tested by 1

operationUnmarshalerFunction · 0.74