@@ -17,10 +17,11 @@ type user struct {
1717var data map [string ]user
1818
1919/*
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
2425*/
2526var userType = graphql .NewObject (
2627 graphql.ObjectConfig {
@@ -37,13 +38,14 @@ var userType = graphql.NewObject(
3738)
3839
3940/*
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
4749*/
4850var queryType = graphql .NewObject (
4951 graphql.ObjectConfig {
@@ -97,7 +99,7 @@ func main() {
9799 http .ListenAndServe (":8080" , nil )
98100}
99101
100- //Helper function to import json from file to map
102+ // Helper function to import json from file to map
101103func importJSONDataFromFile (fileName string , result interface {}) (isOK bool ) {
102104 isOK = true
103105 content , err := ioutil .ReadFile (fileName )
0 commit comments