forked from wundergraph/graphql-go-tools
/
entity.resolvers.go
27 lines (21 loc) · 904 Bytes
/
entity.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package graph
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
// Code generated by github.com/99designs/gqlgen version v0.17.22
import (
"context"
"github.com/dchukmasov/graphql-go-tools/examples/federation/products/graph/generated"
"github.com/dchukmasov/graphql-go-tools/examples/federation/products/graph/model"
)
// FindProductByUpc is the resolver for the findProductByUpc field.
func (r *entityResolver) FindProductByUpc(ctx context.Context, upc string) (*model.Product, error) {
for _, h := range hats {
if h.Upc == upc {
return h, nil
}
}
return nil, nil
}
// Entity returns generated.EntityResolver implementation.
func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} }
type entityResolver struct{ *Resolver }