forked from wundergraph/graphql-go-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entity.resolvers.go
30 lines (23 loc) · 929 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
28
29
30
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/v2/examples/federation/accounts/graph/generated"
"github.com/dchukmasov/graphql-go-tools/v2/examples/federation/accounts/graph/model"
)
// FindUserByID is the resolver for the findUserByID field.
func (r *entityResolver) FindUserByID(ctx context.Context, id string) (*model.User, error) {
name := "User " + id
if id == "1234" {
name = "Me"
}
return &model.User{
ID: id,
Username: name,
}, nil
}
// Entity returns generated.EntityResolver implementation.
func (r *Resolver) Entity() generated.EntityResolver { return &entityResolver{r} }
type entityResolver struct{ *Resolver }