Questions tagged [gqlgen]

gqlgen is a Go library for building GraphQL servers. Use this tag for questions about using the github.com/99designs/gqlgen library. Use also the [go] tag and tags about web server frameworks you use gqlgen with, as appropriate.

The gqlgen project includes a runnable command that generates Go types from .graphqls schema files and most of the glue code to build a GraphQL server.

The gqlgen repository is located at: https://github.com/99designs/gqlgen

79 questions
1
vote
1 answer

How to UT upload files

I'm working on making UT for my GraphQL API. I need to test a mutation where I upload a file. I am using gqlgen on this project. ... localFile, err := os.Open("./file.xlsx") if err != nil { …
Theo Fenique
  • 105
  • 1
  • 7
1
vote
1 answer

Custom error status code with gqlgen + go gin

Recently I have been updating my GO REST APIs into graphQl API's and I came across issue where I am unable to customise my status code with gqlgen. Response I got Headers Status Code: 200 OK { data: null, errors: [ {message: "Unauthorized…
Mehnaz Bano
  • 53
  • 1
  • 7
1
vote
0 answers

How to order slice of pointers using gqlgen and dataloaden (graphql dataloader) if some keys are NULL?

I have these entities: Golang struct: type Player struct { ID int CreatedAt time.Time City City CityID int Team *Team TeamID *int Score int } GraphQL schema: type Player { id: ID! …
Fred Hors
  • 3,258
  • 3
  • 25
  • 71
0
votes
1 answer

GqlGen incorrectly generates directives that have colon character in value field

I use https://github.com/99designs/gqlgen for generating golang code from graphql schema. I need to be able to add gorm tags to the resulting golang types. For that, I declare a directive for custom go tags (in schema.directives.gql): directive…
Andrey
  • 20,487
  • 26
  • 108
  • 176
0
votes
1 answer

Unable to use UUID for ID types within gqlgen's GraphQL models

I'm trying to use a UUID type (from module github.com/gofrs/uuid) within Go models. I do usually define models manually, unless I know they won't be augmented. This is what I currently have: package model import "github.com/gofrs/uuid" type…
x80486
  • 6,627
  • 5
  • 52
  • 111
0
votes
0 answers

pg: Model(unsupported string) error when inserting ciphertext with gqlgen api

I'm trying to insert emails that have been encrypted to cyphertext into a postgresql database from a graphql api written with golang's gqlgen library. The emails were inserting into the database just fine in plain text, but when I encrypt them to a…
megajon
  • 37
  • 2
0
votes
0 answers

How can I handle a batch graphql request in gqlgen?

I could use some help figuring out how to handle a batch request in gqlgen. The request is coming from an apollo client using apollo's query batching, so the request body is a json array like so: [ { "operationName":"UpdateDocument", …
Alex K
  • 1
  • 2
0
votes
1 answer

What is the right way to conditionally assign multiple properties to a struct

I'm working on a resolver function for a GraphQL query for a BE I'm writing in Go. In the resolver, I have user data that I want to update, using an input value containing several possible update properties. In JavaScript, this can be done quickly…
Josh Winskill
  • 359
  • 2
  • 8
0
votes
1 answer

Access Custom Type's Original Functions

How do I access the original functions of a customized type in Go? I do not believe this is not specific to gqlgen, but my use-case heavily involves their framework. I'm trying to build a custom scalar for dates in gqlgen following their setup here:…
Francis Bartkowiak
  • 1,374
  • 2
  • 11
  • 28
0
votes
0 answers

go get github.com/99designs/gqlgen not downloading/installing stuff in the directory it should do so

I'm in a directory and I run go get github.com/99designs/gqlgen no folders or files get added. I tried running the same command above with the -u and -v flags and I do get verbose output meaning stuff is being downloaded, etc. But still no new…
uber
  • 4,163
  • 5
  • 26
  • 55
0
votes
1 answer

404 page not found when trying to use Gqlgen with julienschmidt/httprouter

Below is the code I run the issue is that I get 404 page not found instead of the graphql playground page Is it possible to work with httprouter with gqlgen or do I need to go back to chi or mux I also was not able to use middlewares because r does…
0
votes
1 answer

React Native. Upload file apollo client

I ask for the help of specialists, I am new to React Native and faced such a problem. enter image description here Trying to send the file this way with a single button click using react-native-image-crop-picker I already sent files to the server on…
0
votes
1 answer

Skip some fields in generating GraphQl models

I use gqlgen library in my Golang project to generate resolvers and models from GraphQl files. In my project, I use a mechanism to generate a query from models generated by gqlgen. All things are true when that model doesn't have relational fields…
0
votes
1 answer

How to convert string to sqlx.types.JSONText?

I am using gqlgen, sqlx and pgx. Trying to use custom scalar to store as jonb type in postgres database. // graph/model/item.go type Attributes types.JSONText // Marshal here ... func (a *Attributes) UnmarshalGQL(v interface{}) error { switch…
Swix
  • 1,883
  • 7
  • 33
  • 50
0
votes
1 answer

Convert JSON.RawMessage to JSON

I am using gqlgen, sqlx and pgx. And I'm trying to use a custom scalar for sqlx's types.JSONText. I have this attributes jsonb field in items table. -- migrations/001_up.sql CREATE TABLE IF NOT EXISTS items ( id UUID PRIMARY KEY DEFAULT…
Swix
  • 1,883
  • 7
  • 33
  • 50