How mature is Graphql with Go?

polaris · · 547 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I am getting tired of adding last minute endpoints to our &#34;REST&#34; api. When functionality is constantly changing, and all the time I have is to just implement, the &#34;REST&#34; api starts to become a mess.</p> <p>I&#39;m thinking that with with graphql things should be a bit more organized, since there is really only mutations and queries.</p> <p>But seeing the go libraries for graphql I&#39;m not too sure if it&#39;s ready for production yet, or how convenient they are to develop in.</p> <p>Has anyone been using Go with graphql in production? Whats your take on it?</p> <p>Go is very important for us, but I&#39;m beginning to think about gong back to, gasp, PHP or even try out Apollo&#39;s graphql server.</p> <hr/>**评论:**<br/><br/>singular_pirate: <pre><p>It&#39;s a shame someone grabbed the very search engine friendly <code>graphql-go/graphql</code>.</p> <p><a href="https://github.com/neelance/graphql-go">https://github.com/neelance/graphql-go</a> is very idiomatic and is actively developed. Go and GraphQL are a natural match, and this library leverages those strengths.</p></pre>joefitzgerald: <pre><p>We&#39;re also using <a href="https://github.com/neelance/graphql-go">https://github.com/neelance/graphql-go</a> and it&#39;s a great solution for us.</p></pre>sh41: <pre><p>For those who don&#39;t know, <a href="https://github.com/neelance">https://github.com/neelance</a> is the main creator of GopherJS (<a href="https://github.com/gopherjs/gopherjs/graphs/contributors">https://github.com/gopherjs/gopherjs/graphs/contributors</a>). He&#39;s actively working on graphql-go, so it&#39;s no surprise it&#39;s a great library.</p></pre>drink_with_me_to_day: <pre><p>Nice, good to have more people in vouching for it. I had seen a comment about neelance&#39;s version, but it was over 3 months ago, and the repo looked a bit empty. I&#39;ll take another look.</p></pre>saviorisdead: <pre><p>Disclaimer: we have GraphQL server built with <a href="https://github.com/graphql-go/graphql" rel="nofollow">https://github.com/graphql-go/graphql</a> running in production for almost a year now and actively working on replacing it.</p> <p>I will say that Go is bad fit for that task. Main reason is nature of GraphQL, it&#39;s just too much for Go&#39;s type system and in the end you forced to use <code>interface{}</code> everywhere. As a result of that code looks worse, it&#39;s hard to support and maintain. And don&#39;t forget about performance penalty of <code>interface{}</code>. Better approach, in my opinion is to build GraphQL server in different programming language, with better support for that kind of task (JS and TypeScript or even Scala) and fetch required data via gRPC calls to Go-based services.</p></pre>kidovate: <pre><p>I&#39;m sorry to say that you guys are not using the right approach. In Go the best way to do it is static code analysis with interfaces, funcs, and labeled fields filling your GraphQL schema. </p> <p>Neelance and I both do it this way:</p> <ul> <li><a href="http://github.com/neelance/graphql-go">http://github.com/neelance/graphql-go</a></li> <li><a href="http://github.com/rgraphql/magellan">http://github.com/rgraphql/magellan</a></li> </ul> <p>Go is most certainly suitable for Graphql especially with it&#39;s strong parallelism and concurrency. You&#39;re just not using the right library for the job. </p></pre>thesnowmancometh: <pre><p>Really glad I read these threads before starting to use <code>graphql-go/graphql</code>! I haven&#39;t seen these alternatives before.</p></pre>drink_with_me_to_day: <pre><p>Yeah, Go&#39;s type system is a big pain, even doing just normal REST.</p> <p>It&#39;s unfortunate, because Go is just a great fit for us, and being able to compile and deploy a single binary is very attractive.</p></pre>nemith: <pre><p>Go just doesn&#39;t fit the way you are used to. If you try to apply dynamic typed language ways to Go you will have a bad time.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

547 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传