github.com/maeglindeveloper/gqlgen@v0.13.1-0.20210413081235-57808b12a0a0/example/federation/products/graph/entity.resolvers.go (about) 1 package graph 2 3 // This file will be automatically regenerated based on the schema, any resolver implementations 4 // will be copied through when generating and any unknown code will be moved to the end. 5 6 import ( 7 "context" 8 9 "github.com/99designs/gqlgen/example/federation/products/graph/generated" 10 "github.com/99designs/gqlgen/example/federation/products/graph/model" 11 ) 12 13 func (r *entityResolver) FindProductByUpc(ctx context.Context, upc string) (*model.Product, error) { 14 for _, h := range hats { 15 if h.Upc == upc { 16 return h, nil 17 } 18 } 19 return nil, nil 20 } 21 22 // Entity returns generated.EntityResolver implementation. 23 func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} } 24 25 type entityResolver struct{ *Resolver }