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
9
votes
1 answer

embedding golang server with flutter

I have web server written in golang which uses graphql package gqlgen and gorm for database. Since golang can be compiled and run on android I wanted to create offline version of my app where sqlite can be used for offline storage and import my…
Nux
  • 5,890
  • 13
  • 48
  • 74
8
votes
1 answer

gqlgen - DirectiveResolver not exported by package generated

I am new to GraphQL, gqlgen library. Tried running go run github.com/99designs/gqlgen init command but getting validation failed: packages.Load: C:\Users\Aylin\Desktop\gqlgen-tutorial\graph\prelude.resolvers.go:19:44: __DirectiveResolver not…
Helen Grey
  • 439
  • 6
  • 16
6
votes
0 answers

Golang mongodb build reference relationship

I have this one-to-many reference relationship in graphql with Mongo go driver. type User { id: ObjectID! email: String! username: String! posts: [Post!]! } type Post { id: ObjectID! author: User! title: String! …
The questioner
  • 724
  • 10
  • 21
6
votes
1 answer

unit testing GraphQL in Golang

in this case I am using Echo mongo-driver (MongoDB) gqlgen graphql type safe is there any simple example for testing my Mutation and Query ? I do love to get advices for this. I have tried to find but can't found any so far, thank you :)
Weq Iou
  • 233
  • 4
  • 13
5
votes
0 answers

gqlgen: Unwanted Resolver is generated

I'm using gqlgen, and I'd like to add a new method to the Query resolver. The added method looks something like this: type Query { ... Foo(bar: Int!): Foo ... } The type for Foo is already declared in the file and is being mapped properly to a…
Jay K.
  • 546
  • 2
  • 10
  • 17
4
votes
2 answers

How to propagate context values from Gin middleware to gqlgen resolvers?

I am trying to extract user_id in token authentication middleware and pass it to gqlgen's graphql resolver function (to populate created_by and updated_by columns of GraphQL schema). Authentication part works without any problems. The Gin…
Helen Grey
  • 439
  • 6
  • 16
4
votes
2 answers

Unsupported relations in gorm

I'm trying to Preload data from a One to Many relationship, yet I always get an "ApiKeys: unsupported relations for schema Client" error. (The reason structs are pointers is because I'm using gqlgen and that's the default configuration) type Client…
Helios
  • 43
  • 1
  • 1
  • 5
4
votes
1 answer

gqlgen Set cookie from resolver

I'm using gin and gqlgen. I was need to set cookie from resolver but all I have in my resolver is context and inputs from graphQL. This question is already answered in github. But this one is different because I can't change ctx.Writer.Write and…
Mreza0100
  • 328
  • 1
  • 9
4
votes
3 answers

Adding CORS header into gqlgen default example?

I'm trying to setup up a basic stack using React, Apollo served by graphQL served by Go through gqlgen. I'm following the getting started guide for gqlgen, which works fine. I'm also following the getting started guide for Apollo, which works…
Carrein
  • 3,231
  • 7
  • 36
  • 77
3
votes
1 answer

set graphql's max file upload size (golang)

I wrote an server in golang which to which files can be uploaded using multipart form. I want to extend the maximum upload size. On the documentation site of the implementation I'm using I found following: uploadMaxSize This option specifies the…
stukoi
  • 33
  • 4
3
votes
0 answers

Adding directive to specific field

I created an Auth directive and passed it to just one query but seems like no query works if that single one fails. This is not the given expectation What did you expect? I want only the query to reflect this directive Minimal graphql.schema and…
King
  • 1,885
  • 3
  • 27
  • 84
3
votes
1 answer

GqlGen - Accessing query input params in field resolver

After generating the code using GqlGen there are some field resolvers method that has been created. I need to access the query input param in the field resolver but I'm not sure how to access it. Do I need to get these values from context? Or is…
Shashank Sachan
  • 520
  • 1
  • 8
  • 20
3
votes
1 answer

gqlgen failing to recognize custom type

My gqlgen models: models: Int64: model: - github.com/99designs/gqlgen/graphql.Int64 ID: model: - github.com/99designs/gqlgen/graphql.ID - github.com/99designs/gqlgen/graphql.Int …
Nicole Staline
  • 557
  • 4
  • 15
2
votes
1 answer

Will graphql expose the schema structure to user ? or I should dealing access control by myself when work with gqlgen and ent

Since Golang ent library will automatically generate the graphql schema base the struct , but it will also generate the whole schema include something you don't want to expose to client, for example like "hassedpassword" , type User implements…
talpx
  • 21
  • 1
2
votes
0 answers

Got some error when generate Graphql with gqlgen

I get an error when I try to generate schema in gqlgen : type : go run github.com/99designs/gqlgen generate Errors : ..\..\..\..\..\go\pkg\mod\github.com\99designs\gqlgen@v0.17.33\main.go:20:2: missing go.sum entry for module providing package…
1
2 3 4 5 6