Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are you aware of another Go GraphQL client? #2

Closed
dmitshur opened this issue Dec 9, 2017 · 5 comments
Closed

Are you aware of another Go GraphQL client? #2

dmitshur opened this issue Dec 9, 2017 · 5 comments

Comments

@dmitshur
Copy link

dmitshur commented Dec 9, 2017

Hey @matryer!

I just discovered the existence of this Go GraphQL client via reddit.

I hope you don't mind this question, but I wanted to ask if https://github.com/shurcooL/graphql (and/or https://github.com/shurcooL/githubql) is on your radar already or not? It's an open source Go implementation of a GraphQL client. If you're interested, I can share some links with additional background information on its design and history, API design decisions and tradeoffs, etc.

Let me know if you're open to talking more about this and potentially working together to improve our projects. My goal is for Go users to have as nice a Go GraphQL client available to them as possible.

Thanks!

@matryer
Copy link
Contributor

matryer commented Dec 11, 2017

Yes, I did see it. I mostly liked it, except for the complication around using structs for requests. When I tried to use that I failed, and that's why I made one that just took strings for requests. Otherwise, I think they're pretty similar.

@matryer matryer closed this as completed Dec 11, 2017
@dmitshur
Copy link
Author

Yes, I did see it.

Good to hear!

except for the complication around using structs for requests. When I tried to use that I failed

I see, thanks for feedback. By any chance, do you remember what the query was? (It's np if not, of course.)

I'm considering making a GraphQL query -> Go code tool to make the conversion process easier.

@matryer
Copy link
Contributor

matryer commented Dec 11, 2017 via email

@dmitshur
Copy link
Author

dmitshur commented Dec 11, 2017

This means that every query (probably) is going to be unique.

I agree.

as long as it doesn’t add loads of structs or other types to your code (it could always do this inside function bodies so they don’t clog up the global space) it could be pretty cool.

My GraphQL queries usually involve writing a var q struct { ... } that defines the query. There's rarely a need to make global types for queries, other than to share common fragments that are used by many queries. As I understand, you need to provide a type/variable that's very similar in nature as 3rd parameter to Run.

To clarify what I meant by a "GraphQL query -> Go code tool", an example input to it would be a query like:

query {
	me {
		name
	}
}

And the generated Go struct for that would be:

var query struct {
	Me struct {
		Name string
	}
}

(No global types are involved.)

@matryer
Copy link
Contributor

matryer commented Dec 11, 2017

Yeah, honestly I don't hate it. The more complicated cases did start to look a bit too complicated though, with struct tags etc.

markya0616 pushed a commit to markya0616/graphql that referenced this issue Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants