-
Notifications
You must be signed in to change notification settings - Fork 0
/
resolver.go
44 lines (33 loc) · 1012 Bytes
/
resolver.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
43
44
package charts
import (
"context"
)
type Resolver struct{}
func (r *Resolver) Mutation() MutationResolver {
return &mutationResolver{r}
}
func (r *Resolver) Query() QueryResolver {
return &queryResolver{r}
}
// New returns a Config that has all of the proper settings for this graphql
// server.
func New() Config {
c := Config{
Resolvers: &Resolver{},
}
return c
}
type mutationResolver struct{ *Resolver }
func (r *mutationResolver) CreateLineGraph(ctx context.Context, input NewLineGraph) (*Graph, error) {
return CreateLineGraph(ctx, input)
}
func (r *mutationResolver) CreatePieGraph(ctx context.Context, input NewPieGraph) (*Graph, error) {
return CreatePieGraph(ctx, input)
}
func (r *mutationResolver) CreateTimeseriesGraph(ctx context.Context, input NewTimeseriesGraph) (*Graph, error) {
return CreateTimeseriesGraph(ctx, input)
}
type queryResolver struct{ *Resolver }
func (r *queryResolver) GetGraph(ctx context.Context, id string) (*Graph, error) {
return GetGraph(ctx, id)
}