1package resolvers
2
3import (
4 "context"
5
6 "github.com/MichaelMure/git-bug/bug"
7)
8
9type personResolver struct{}
10
11func (personResolver) Name(ctx context.Context, obj *bug.Person) (*string, error) {
12 if obj.Name == "" {
13 return nil, nil
14 }
15 return &obj.Name, nil
16}
17
18func (personResolver) Email(ctx context.Context, obj *bug.Person) (*string, error) {
19 if obj.Email == "" {
20 return nil, nil
21 }
22 return &obj.Email, nil
23}
24
25func (personResolver) Login(ctx context.Context, obj *bug.Person) (*string, error) {
26 if obj.Login == "" {
27 return nil, nil
28 }
29 return &obj.Login, nil
30}
31
32func (personResolver) AvatarURL(ctx context.Context, obj *bug.Person) (*string, error) {
33 if obj.AvatarUrl == "" {
34 return nil, nil
35 }
36 return &obj.AvatarUrl, nil
37}