forked from wundergraph/graphql-go-tools
/
datasource_type.go
48 lines (38 loc) · 1.07 KB
/
datasource_type.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
45
46
47
48
package datasource
import (
"context"
"encoding/json"
"io"
)
type TypeDataSourcePlannerConfig struct {
}
type TypeDataSourcePlannerFactoryFactory struct {
}
func (t TypeDataSourcePlannerFactoryFactory) Initialize(base BasePlanner, configReader io.Reader) (PlannerFactory, error) {
factory := TypeDataSourcePlannerFactory{
base: base,
}
return factory, json.NewDecoder(configReader).Decode(&factory.config)
}
type TypeDataSourcePlannerFactory struct {
base BasePlanner
config TypeDataSourcePlannerConfig
}
func (t TypeDataSourcePlannerFactory) DataSourcePlanner() Planner {
return SimpleDataSourcePlanner(&TypeDataSourcePlanner{
BasePlanner: t.base,
dataSourceConfig: t.config,
})
}
type TypeDataSourcePlanner struct {
BasePlanner
dataSourceConfig TypeDataSourcePlannerConfig
}
func (t *TypeDataSourcePlanner) Plan(args []Argument) (DataSource, []Argument) {
return &TypeDataSource{}, append(t.Args, args...)
}
type TypeDataSource struct {
}
func (t *TypeDataSource) Resolve(ctx context.Context, args ResolverArgs, out io.Writer) (n int, err error) {
return
}