Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 13:57
    coveralls commented #2175
  • 13:43
    StevenACoffman commented #2174
  • 13:26
    coveralls commented #2174
  • May 19 23:53
    ianling commented #2175
  • May 19 23:32
    ianling edited #2175
  • May 19 23:30
    ianling opened #2175
  • May 19 19:56
    ianling commented #2174
  • May 19 19:55
    ianling synchronize #2174
  • May 19 19:51
    ianling ready_for_review #2174
  • May 19 19:51
    ianling edited #2174
  • May 19 19:49
    ianling edited #2174
  • May 19 19:49
    ianling synchronize #2174
  • May 19 16:49
    StevenACoffman commented #2173
  • May 19 16:40
    clayne11 closed #2173
  • May 19 16:40
    clayne11 commented #2173
  • May 18 21:26
    StevenACoffman commented #2174
  • May 18 21:15
    ianling commented #2174
  • May 18 21:15
    ianling commented #2174
  • May 18 21:12
    ianling converted_to_draft #2174
  • May 18 21:12
    coveralls commented #2174
Andrew Marine
@amarine7882
Our GraphQL server has a number of models where we want to bind to a method on the model instead of generating a resolver on the root resolver. like this. What is the best way to access the database from in the model? Is it possible to have the dependancies injected into the resolver also injected into the model?
Jonathan Duck
@duckbrain
Your model method can have a first argument of context.Context. We've used that to pass all sorts of values throughout our app. (DB connection, Session, Logger, etc.). An http/operation middleware can inject the values in the context for all requests.
1 reply
Anthony Lobko
@anthonylobko
Hi, new here, just wondering how to use the apollotracing handler that's listed https://github.com/99designs/gqlgen/tree/master/graphql/handler/apollotracing . I don't see it documented anywhere how to set it up, but I really wanted to see this kind of telemetry if it's supported
Anthony Lobko
@anthonylobko
Nevermind, sorted it out
Andrew Ray
@andrewray_twitter
I'm trying to figure out how to build the gqlgen project locally. I ran go generate ./... and spat out 4 package lines, then hung for 10 minutes, so I killed it
when I run it again, it spat out some error lines, and now it's hanging again
go: finding module for package github.com/99designs/gqlgen/example/federation/accounts/graph/model tidy failed: go mod tidy failed: exit status 1 exit status 3
should I just be patient, or am I missing a step?
Andrew Ray
@andrewray_twitter
the tidy errors went away the second time I ran it, it seems to have generated successfully now
jongno-gu
@jongno-gu
Hi all. Is there any way to write "TYPE DETAILS" in playground docs?
jongno-gu
@jongno-gu

Hi all. Is there any way to write "TYPE DETAILS" in playground docs?

Scalar types has "TYPE DETAILS" but, custom types dosen't have.

John Burke
@IceeMC
Hi, I keep getting this error when running go run github.com/99designs/gqlgen generate
resolvergen: package not found for importPath: api/graphexit status 1
Dany Henriquez
@danyhenriquez:matrix.org
[m]

I ant to add Gorm fields to the models fo gqlgen. I am trying to figure out where to put the modelgen hook file ad how it is used. Is there a pattern for it?

This is the documentation i am referring to -> https://gqlgen.com/recipes/modelgen-hook/

Dany Henriquez
@danyhenriquez:matrix.org
[m]
Nevermind. The structure is clear now
Dany Henriquez
@danyhenriquez:matrix.org
[m]
/can anyone help? The auth example from the Docs is not working. The Forcontext returns nil and not the reference https://gqlgen.com/recipes/authentication/
Epo Jemba
@ejemba
Hi o/ newbie here ! I'm just playing with gqlgenc (client part). There is a models part of the config file .gqlgenc.yml that I can not understand how it works. I have the following message :
modelgen failed: unable to find type github.com/99designs/gqlgen/graphql.Float
my config file is http://ix.io/3uqf
Epo Jemba
@ejemba
ok fixed my problem myself
my project was not properly go mod initialised and after a go get github.com/99designs/gqlgen everything was fine
kvtx
@kvtx:matrix.org
[m]
anyone here?
I'm trying to figure out if i can control the call chain order of directives to ensure that one is called before another... possible?
1 reply
Eric
@elucidsoft
Hi guys, whenever I run gqlgen it throws an error saying "validation failed: packages.Load: -: no matching versions for query "latest"" I found where this was talked about in a GitHub issue, seems like it was fixed but I still get it with latest version of gqlgen. It doesn't seem to break anything, everything is still generated perfectly fine.
Mojtaba Cazi
@mojtabacazi
Hello, is there a way to know if an error generated by gqlgen was a client error (aka request error) or a field error ?
Zen Yui
@zenyui

Hey! I put together a small sample integrating graph-gophers/dataloader with GqlGen, and IMO it's pretty straight forward. What do you guys think? Would this be worth offering as an option in the GqlGen dataloader docs?

https://github.com/zenyui/gqlgen-dataloader

zhaoyta
@zhaoyta
hi
is gqlgen has directive that lick apollo export directive
zhaoyta
@zhaoyta
hi
Davae Wanliss
@davae1an
hello
keep getting weird errors in sub fields that are manged by a federated schema
invalid character '$' looking for beginning of value
it seems to be an unmarshall error
Luke Cawood
@lwc
hey everyone, we're moving gqlgen chat to discord, here's an invite link :) https://discord.gg/DYEq3EMs4U
Davae Wanliss
@davae1an
oh
thnx
zhaoyta
@zhaoyta
Is there any way to control the sequence of resolvers´╝îbecause some resolver depenency other resolver result
help
darshanEffectiv
@darshanEffectiv
Is there a way to set the OperationName from the OperationContext for logging purposes? I know we can intercept the request body and get the value from the context?
marcintustin
@marcintustin
Hi, is there a defined order in which resolvers are called, or another way to get access in the resolution process to which fields are being requested
Basically, I want to fire off as few sql queries as possible so I'd like to custom tailor my sql query based on what's being requested
marcintustin
@marcintustin
It looks like a clue to my answer is here: https://gqlgen.com/reference/field-collection/
David Pennington
@housingdreams

When dealing with client requests for other resolvers, it's normal for the graphql implementations to call whatever nested resolvers were asked for without you needing to do it manually. It seems like with gqlgen, you have to embed a lot of 'if' statements to manually call other resolvers. Imagine a 'well-connected' entity like a user account which might have 10 different checks to https://gqlgen.com/reference/field-collection/ to know what nested resolvers to call. Is this correct?

If I have a query like query { A { B { C { name } } } } do I have to embed if checks in A for B, and checks in B for C?

2 replies
dtrckd
@dtrckd:matrix.org
[m]
HI there, is there a way or known practices to forward a gql query to another endpoint with gqlgen ?
https://github.com/99designs/gqlgen/discussions/2049
David Pennington
@housingdreams
How do I regenerate the code? go run github.com/99designs/gqlgen and go generate ./... don't seem to pickup changes
Jon Watte
@jwatte
I create a minimal schema (just a type and a query that returns that type) and run "go generate" on 0.17.2, and I get a bunch of errors that all say generated.go:784:15: ec._fieldMiddleware undefined (type *executionContext has no field or method _fieldMiddleware)
Is this known? Something else I need to do first?
Terry Liu
@sudotliu

Is there a good resource for how to write a basic filter query while using gqlgen?

For example, if I wanted to filter all members by those with a given name, my schema might look like:

type Query {
  members(name: String): [Member!]! 
}

How would one cleanly handle this in the resolver? It feels like we would have to check for the name input and then conditionally adjust the underlying SQL query based on the existence of that field by appending a WHERE name = ? clause. That feels so clunky, I'm quite convinced I'm missing something and that there's a better way....

Rick F
@riFaulkner
Does gqlgen support mapping Enums to alternate, explicit values? Typescript qgl supports creating Enums that map to other strings, for example
enum Direction {
  UP = "up",
  DOWN = "down",
  LEFT = "left",
  RIGHT = "right",
}
Jon Watte
@jwatte
@sudotliu That is exactly how you need to implement filtering. GQL is not a database query language by itself, and the gqlgen code can't know which particular database or schema you're using, so it can't generate SQL for you. (You might not even be using SQL!)
If you want something that's a little more automatic in that mapping, try something like Hasura. (Not Go, though.)
Nguionza Desire
@zadiv_gitlab
collected field
Nguionza Desire
@zadiv_gitlab
Hi! Everyone is there a simple way to get preloaded field in map[string]interface{} format to easily use pluck or projection in nosql database ? My first attempt was to use regex to filter the GetPreloads(ctx) method with something like var regExp = regexp.MustCompile(([\w]+\.)+[\w]+([\s]|$)) then with a loop trying to match nested key and it value but it seem overload for me...instead can we move it the GePreloads(ctx) itself and try to have a work around? for example in rethinkdb pluck need {key: true, nested: {child: true}} to perform...can you guy point me a direction please!!!