-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
entity.resolvers.go
42 lines (34 loc) · 1.31 KB
/
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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.36-dev
import (
"context"
"github.com/99designs/gqlgen/_examples/federation/reviews/graph/model"
)
// FindProductByManufacturerIDAndID is the resolver for the findProductByManufacturerIDAndID field.
func (r *entityResolver) FindProductByManufacturerIDAndID(ctx context.Context, manufacturerID string, id string) (*model.Product, error) {
var productReviews []*model.Review
for _, review := range reviews {
if review.Product.ID == id && review.Product.Manufacturer.ID == manufacturerID {
productReviews = append(productReviews, review)
}
}
return &model.Product{
ID: id,
Manufacturer: &model.Manufacturer{
ID: manufacturerID,
},
Reviews: productReviews,
}, nil
}
// FindUserByID is the resolver for the findUserByID field.
func (r *entityResolver) FindUserByID(ctx context.Context, id string) (*model.User, error) {
return &model.User{
ID: id,
Host: &model.EmailHost{},
}, nil
}
// Entity returns EntityResolver implementation.
func (r *Resolver) Entity() EntityResolver { return &entityResolver{r} }
type entityResolver struct{ *Resolver }