Questions tagged [graphql-go]

github.com/graphql-go/graphql is a Go package that provides an implementation of GraphQL. Use this tag together with [go] and other tags about the web frameworks, if any, that you use graphql-go with.

The graphql-go repository is located at: https://github.com/graphql-go/graphql

34 questions
1
vote
2 answers

golang, creating relation between 2 model and retrieve them with Preload using gorm

I am learning golang with gqlgen and gorm as orm, I am creating an app using with 2 models user and messages where the user has a list of messages, and the messages have sender and recipient. I have made them like the following type User struct { …
Snowflake
  • 191
  • 1
  • 2
  • 13
1
vote
1 answer

graphql-go define field type as object

Using graphql-go how do we handle nested objects as in given api returns the following in resolver { id:"34", name:"something", region:{ id:34, name: "San jose" } } how do we implement for region: "region": &graphql.Field{ …
Ivanz
  • 11
  • 2
1
vote
1 answer

Global variables and Go

I am currently trying to work on a small Go project, and I have a problem I am trying to solve. I'm currently using github.com/jinzhu/gorm to handle database operations for the backend of a GraphQL server, and I wanted to be able to store the DB…
MisutoWolf
  • 1,133
  • 1
  • 18
  • 33
0
votes
0 answers

How to create graphql-go *graphql.Schema from JavaScript string?

How to create graphql schema from string in Go? This is my schema, here shown as a JavaScript string: const schemaContent = `type Query { greeting:String students:[Student] } type Student { …
0
votes
0 answers

Golang graphql : restriction of graphql functionality by role

I have a backend server running with golang and graphql. Anyone who connects to this server can currently access all graphql features and services if they have a valid Bearer (JWT ). I would like for a certain group of users, certain services to be…
0
votes
1 answer

How to attach JWT token to the header of graphql subscription

I am currently building chat application with microservice architecture, where auth(login and signup) service and chat service are separated using Graphql. I was trying to attach a JWT to the request header of query, mutation and subscription to…
0
votes
1 answer

Pass parent resolver arguments in child resolver

I have a nested GraphQL query with the following structure query{ parentMetrics(cityNames: ["Cali"], orderingDateFrom: "2021-01-01"){ sales orders childMetrics(cityNames: ["Cali"],…
0
votes
2 answers

$push string as an array in mongo document

I'm having trouble understanding arrays in Go, especially with both graphql and mongo. With JS this all would've been a breeze for me, but I'm wondering if you can look at what I have and point out the obvious! I'm looking for an object to be shaped…
user16663541
0
votes
1 answer

GraphQL - Use Object as argument

I am building an API using GraphQL and one of the options of the API is to place an order I am using Go 1.16 with graphql-go as the GraphQL backend The JSON format for the PlaceOrder API call is: { "order_reference":"unique order reference", …
clcordell
  • 57
  • 1
  • 10
0
votes
1 answer

Some of my go-graphql queries' fields are returning null while other fields come back fine and other similar queries work all together

I have been experimenting with go-grapqhql and I have been able to successfully create some schemas such as this: type Artist struct { ID string `json:"id,omitempty"` Name string `json:"name"` Type string `json:"type"` Instrument…
tsm
  • 419
  • 4
  • 11
0
votes
1 answer

Why doesn't my GraphQL query return the right result when triggered from GO?

I'm new to both Hasura/Graphql and GO. I've succeeded in writing a couple of Hasura actions which are supported by a GO server which in turn calls the Hasura server to run a query. These both work. For some reason the third one does not and I cannot…
SusanAdey
  • 11
  • 1
0
votes
1 answer

graphql mutation query error using graph-gophers/graphql-go package

PROBLEM the mutation below mutation { signUp(signUpInput: {email: "newuser@gmail.com", username: "newUser", password: "asdfasdfawerawer"}) { email username } } errors out the following { "errors": [ { "message":…
user3366943
  • 253
  • 1
  • 6
0
votes
1 answer

The base64 hash of my node id is not what I expect

I am using the graphql-go library along with graphql-go/relay. I am trying to write some basic tests for my API, and am having some trouble with the base64 encoding mechanism. When I execute a simple query for viewer id, the viewer encoded id is…
jordancooperman
  • 1,931
  • 2
  • 21
  • 33
0
votes
1 answer

What does "graphql.NewList(type)" do?

As it turns out, graphql-go's help doc is not beginner friendly. I'm simply wondering what .NewList() does in, say, the following code: Type: graphql.NewList(types.Workouts)
seemcat
  • 634
  • 1
  • 9
  • 16
0
votes
1 answer

Mutation arguments as object

I'm using the Go implemenatation of GraphQL. How would you configure a mutation so that it can receive arguments with more than 1 level? For exemple, here is the list of arguments I would like to pass to a mutation CreateUser: mutation…
SebScoFr
  • 881
  • 1
  • 9
  • 24