File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package app
3
3
import (
4
4
"fmt"
5
5
6
+ "graphql-go/compatibility-standard-definitions/config"
6
7
"graphql-go/compatibility-standard-definitions/executor"
7
8
"graphql-go/compatibility-standard-definitions/extractor"
8
9
"graphql-go/compatibility-standard-definitions/puller"
@@ -12,6 +13,8 @@ import (
12
13
13
14
// App represents the high level entry point for the application.
14
15
type App struct {
16
+ // Config is the configuration of the application.
17
+ Config * config.Config
15
18
}
16
19
17
20
// RunResult represents the result of the run method.
@@ -42,7 +45,10 @@ func (app *App) Run(params RunParams) (*RunResult, error) {
42
45
43
46
executor := executor .New ()
44
47
45
- ex := extractor .New (executor )
48
+ ex := extractor .New (& extractor.NewParams {
49
+ Config : app .Config ,
50
+ Executor : executor ,
51
+ })
46
52
47
53
extractResult , err := ex .Extract (& extractor.ExtractParams {
48
54
Implementation : params .Implementation ,
Original file line number Diff line number Diff line change 9
9
"os"
10
10
"strings"
11
11
12
+ "graphql-go/compatibility-standard-definitions/config"
12
13
"graphql-go/compatibility-standard-definitions/executor"
13
14
"graphql-go/compatibility-standard-definitions/types"
14
15
)
@@ -23,12 +24,25 @@ const introspectionQueryFilePath string = "./graphql-js-introspection/query.grap
23
24
type Extractor struct {
24
25
// executor is the executor component that extractor delegates the execution of a graphql introspection query.
25
26
executor * executor.Executor
27
+
28
+ // cfg is the configuration of the application.
29
+ cfg * config.Config
26
30
}
27
31
28
- // New returns a pointer to a Extractor struct.
29
- func New (executor * executor.Executor ) * Extractor {
32
+ // NewParams represents the paramters for the new method.
33
+ type NewParams struct {
34
+ // Executor is the executor parameter.
35
+ Executor * executor.Executor
36
+
37
+ // Config is the configuration parameter.
38
+ Config * config.Config
39
+ }
40
+
41
+ // New returns a pointer to an Extractor struct.
42
+ func New (params * NewParams ) * Extractor {
30
43
return & Extractor {
31
- executor : executor ,
44
+ executor : params .Executor ,
45
+ cfg : params .Config ,
32
46
}
33
47
}
34
48
@@ -137,7 +151,9 @@ func (e *Extractor) parseSpec() (types.SpecificationIntrospection, error) {
137
151
}
138
152
}
139
153
140
- log .Println (headingsLevel2 )
154
+ if e .cfg .IsDebug {
155
+ log .Println (headingsLevel2 )
156
+ }
141
157
142
158
spec := types.SpecificationIntrospection {
143
159
QueryResult : types.IntrospectionQueryResult {},
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ func main() {
19
19
log .Fatal (err )
20
20
}
21
21
22
- app := mainApp.App {}
22
+ app := mainApp.App {
23
+ Config : cfg ,
24
+ }
23
25
24
26
runResult , err := app .Run (mainApp.RunParams {
25
27
Specification : cfg .GraphqlSpecification ,
You can’t perform that action at this time.
0 commit comments