@@ -17,10 +17,11 @@ type user struct {
17
17
var data map [string ]user
18
18
19
19
/*
20
- Create User object type with fields "id" and "name" by using GraphQLObjectTypeConfig:
21
- - Name: name of object type
22
- - Fields: a map of fields by using GraphQLFields
23
- Setup type of field use GraphQLFieldConfig
20
+ Create User object type with fields "id" and "name" by using GraphQLObjectTypeConfig:
21
+ - Name: name of object type
22
+ - Fields: a map of fields by using GraphQLFields
23
+
24
+ Setup type of field use GraphQLFieldConfig
24
25
*/
25
26
var userType = graphql .NewObject (
26
27
graphql.ObjectConfig {
@@ -37,13 +38,14 @@ var userType = graphql.NewObject(
37
38
)
38
39
39
40
/*
40
- Create Query object type with fields "user" has type [userType] by using GraphQLObjectTypeConfig:
41
- - Name: name of object type
42
- - Fields: a map of fields by using GraphQLFields
43
- Setup type of field use GraphQLFieldConfig to define:
44
- - Type: type of field
45
- - Args: arguments to query with current field
46
- - Resolve: function to query data using params from [Args] and return value with current type
41
+ Create Query object type with fields "user" has type [userType] by using GraphQLObjectTypeConfig:
42
+ - Name: name of object type
43
+ - Fields: a map of fields by using GraphQLFields
44
+
45
+ Setup type of field use GraphQLFieldConfig to define:
46
+ - Type: type of field
47
+ - Args: arguments to query with current field
48
+ - Resolve: function to query data using params from [Args] and return value with current type
47
49
*/
48
50
var queryType = graphql .NewObject (
49
51
graphql.ObjectConfig {
@@ -97,7 +99,7 @@ func main() {
97
99
http .ListenAndServe (":8080" , nil )
98
100
}
99
101
100
- //Helper function to import json from file to map
102
+ // Helper function to import json from file to map
101
103
func importJSONDataFromFile (fileName string , result interface {}) (isOK bool ) {
102
104
isOK = true
103
105
content , err := ioutil .ReadFile (fileName )
0 commit comments