Closed Kartikey-star closed 9 months ago
The struct fields need to be exported, otherwise they can’t be written to via reflection from other packages. Try renaming id
to ID
and title
to Title
.
The struct fields need to be exported, otherwise they can’t be written to via reflection from other packages. Try renaming
id
toID
andtitle
toTitle
.
Thanks. It's working now.
I am trying to query the projects present in my organization using https://github.com/shurcooL/graphql/. When i make a curl request i am able to generate a successul response:
curl --request POST --url https://api.github.com/graphql --header 'Authorization: Bearer TOKEN' --data '{"query":"{organization(login: \"containers\") {projectsV2(first: 20) {nodes {id title}}}}"}'
{"data":{"organization":{"projectsV2":{"nodes":[{"id":"SOMEVAL1","title":"SOMETITLE1"},{"id":"SOMEVAL1","title":"SOMETITLE2"}]}}}}
When i try to create a struct of the above query i do so with:
The error which i get is: struct field for "id" doesn't exist in any of 1 places to unmarshal.
Can you point where i am going wrong here. Thanks.