Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 00:49
    namnm commented #1730
  • 00:49
    namnm commented #1730
  • 00:49
    namnm closed #1730
  • Dec 03 19:19
    tprebs commented #1732
  • Dec 03 18:29
    Kichiyaki commented #1152
  • Dec 03 18:21
    tolik505 commented #1152
  • Dec 03 14:18
    StevenACoffman commented #1737
  • Dec 03 14:18
    StevenACoffman closed #1737
  • Dec 03 14:18
    StevenACoffman closed #1736
  • Dec 03 09:02
    frederikhors commented #1734
  • Dec 03 09:00
    frederikhors synchronize #1734
  • Dec 02 17:15
    zenyui commented #1714
  • Dec 02 17:13
    frederikhors commented #1714
  • Dec 02 06:00
    jimvmathews opened #1739
  • Dec 01 21:17
    lkendrickd commented #1723
  • Dec 01 19:49
    frederikhors commented #1722
  • Dec 01 19:47
    odannyc opened #1738
  • Dec 01 18:00
    MiguelCastillo commented #1723
  • Dec 01 14:48
    StevenACoffman commented #1723
  • Dec 01 14:13
    coveralls commented #1737
Jon Lundy
@JonLundy
ah that is because go expects one module per directory
cpunekar
@cpunekar
@JonLundy not sure what that means, is it related to the folder structure? mine looks like this
```
- models
    - person.go
    - pet.go
- generated.go
- resolver.go
- server.go
- schema.graphql
- gqlgen.yml
Jon Lundy
@JonLundy
hmm resolver is marked as package test_gql ?
you should be able to run with just go run .
cpunekar
@cpunekar
yes, resolver's pkg is test_gql.. still getting the same error with go run .
server is marked with pkg "main"
I tried making resolver and generated.go pkg names as main but got some cycle error, guess it's not that way
Jon Lundy
@JonLundy
hmm should only give you cycle if its trying to import its own package i think
is resolver trying to import the generated ?
cpunekar
@cpunekar
nope.. no references of generated in resolver
Jon Lundy
@JonLundy
what about server.go?
or rather what does it say is cycleing
cpunekar
@cpunekar
user-MacBook-Pro:test-gql user$ go run .
import cycle not allowed
package test-gql
    imports test-gql
Jon Lundy
@JonLundy
imports itsself?
try removing that :)
cpunekar
@cpunekar
package name is "main" in resolver, generated and server
ah yes.. I did import "tets-gql" in server.go (sleep deprived).. not sure how should I write below line since the server.go needs to in the folder as generated.go and resolver.go
cpunekar
@cpunekar
srv := handler.NewDefaultServer(test-gql.NewExecutableSchema(test-gql.Config{Resolvers: &test-gql.Resolver{}}))
Jon Lundy
@JonLundy
just remove the test-gql. from everything
its all defined in the same package
importing from the same directory is a python convention.. its not like that in Go
cpunekar
@cpunekar
the joy when your code works.. thanks to you @JonLundy
Jon Lundy
@JonLundy
np
cpunekar
@cpunekar
just for general knowledge.. what's the folder structure you guys follow for production servers?
Jon Lundy
@JonLundy
I typically have
  • pkg/generated/generated.go
  • pkg/model/model_gen.go
  • pkg/resolvers/...go
Just to keep them separate
I have seen in examples where the generated/models are subdirectory of resolvers
cpunekar
@cpunekar
@JonLundy that makes more sense.. thanks!
Tassios Marios
@mariosttass
Hi guys,
Basically I have a simple question, in case that we have a very complicated schema there is a work around to generate that using gqlgen library?
Thank you.
Jon Lundy
@JonLundy
@mariosttass how do you mean?
like its a large schema? or there are many interconnected types and queries?
Tassios Marios
@mariosttass
  Hi, I was meaning that in case that there are many types and queries. 
Jon Lundy
@JonLundy
is it failing to generate the source files?
Tassios Marios
@mariosttass
No, basically I am asking if there is a way to generate the schema from structs.
Jon Lundy
@JonLundy
ah.. i think some of the other projects for graphql do some things like that. this project is designed around the other way, taking a schema and building a server for it.
Thunder is an example of a struct first approach https://github.com/samsarahq/thunder
Tassios Marios
@mariosttass
Thank you very much @JonLundy
Slava
@m0sth8
Hi. Is it possible to use resolver in Go code to get json object? I have a use case when I need to return graphql object via rpc channel.
Slava
@m0sth8
Seems like I can do this with an Executor exposed in 0.11
Jon Lundy
@JonLundy
Graphql typically returns a json object for requests. Do you mean having the json embedded in a value?
Like {"res":"{\"a\":1}"}
Julien
@juleur
hi
is someone encounter problems with extensions errors ?
Tassios Marios
@mariosttass
Hi guys,
I have a question, I am using gqlgen library with gorm library and I want to use only one model, how I can setup the gqlgen to use the already defined model ?
Thanks !
David Douglas
@ddouglas

Hello All, been using GQLGen for a while now. Just started a fresh project today and I am getting the following error when generating the schema.

validation failed: packages.Load: -: no matching versions for query "latest"

I did some research and i think this is an error from a dependency of gqlgen

Any tips?