For a query or mutation, we must use a wrapper struct as the response struct.
This is very counterintuitive and should be pointed out in the example.
For example, for the following query,
type Query {
lesson(id: ID!): Lesson!
}
We need the following wrapper struct as the response,
type RespData {
Lesson: Lesson json: "lesson"
}
Or we can do as following:
var respData map[string]interface{}
convertMapDataToLesson(respData)
For a query or mutation, we must use a wrapper struct as the response struct. This is very counterintuitive and should be pointed out in the example. For example, for the following query, type Query { lesson(id: ID!): Lesson! } We need the following wrapper struct as the response, type RespData { Lesson: Lesson
json: "lesson"
} Or we can do as following: var respData map[string]interface{} convertMapDataToLesson(respData)