Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 27 23:55
    StevenACoffman closed #2257
  • Jun 27 23:55
    StevenACoffman commented #2257
  • Jun 27 22:56
    coveralls commented #2257
  • Jun 27 20:12
    skaji opened #2257
  • Jun 27 06:52
    sj14 ready_for_review #2256
  • Jun 27 06:52
    sj14 synchronize #2256
  • Jun 27 06:51
    sj14 synchronize #2256
  • Jun 27 06:50
    sj14 synchronize #2256
  • Jun 27 06:49
    sj14 opened #2256
  • Jun 25 13:06
    StevenACoffman commented #2254
  • Jun 25 13:06
    StevenACoffman closed #2254
  • Jun 25 12:55
    frederikhors commented #2207
  • Jun 25 12:55
    frederikhors commented #2207
  • Jun 25 12:53
    AmeyaRao98 commented #2207
  • Jun 25 12:52
    coveralls commented #2254
  • Jun 25 05:47
    abhinavnair synchronize #2254
  • Jun 25 05:38
    abhinavnair synchronize #2254
  • Jun 25 01:48
    abhinavnair ready_for_review #2254
  • Jun 25 01:47
    abhinavnair edited #2254
  • Jun 25 01:44
    abhinavnair synchronize #2254
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!!!
Shivam Mishra
@shimish2

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)

Hi team

I am also getting same type of error while generating.

Terry Liu
@sudotliu

I think I may be misunderstanding something about how autobind works or have simply misconfigured something.

My impression is that setting it like this:

models:
  Todo:
    fields:
      user:
        resolver: true

Means that gqlgen should look to the configured package for custom types already defined to resolve most fields for that type but then also that any explicit fields listed here with resolver: true will have a resolver generate for it regardless.

In my situation, I'm pointing gqlgen autobind package to sqlc-generated models but then resolvers are automatically being generated for far too many fields even when set to resolver: falsein the config for said field.

Any ideas on what I'm missing?

1 reply
Vayuj Rajan
@vyj7
d7t
@dylanlott
@vyj7 what is your desired result with that loop? to me it looks like your for loop is going to block because of the ctx.Done, which you're describing in your problem.
Seems to me you need to put that block after ctx.Done into a goroutine and have it block until ctx.Done returns, so that you can read each message. Right now, that ctx.Done() is going to block and you'll only send one message over your channel.
bhushanuvce
@bhushanuvce:matrix.org
[m]
Hi
Is there any support for stream directive in ggqlgen library ?
Terry Liu
@sudotliu

Is it possible to have multiple models be used as the defaults for resolver arguments? For example, if I have two DB models that are effectively backing a single GQL type, is there a way to take the union of fields under the two DB types and have resolvers auto-resolve those?

The only way now seems to be to pick one type to auto-resolve for and then explicitly resolve the reset even if they're still basic scalars that could effectively be pass-through resolution.

I guess one issue with supporting multiple types is that it can get ambiguous when two types share a common field name, but it's easy enough to force those to be custom-resolved.