<p>Hey, I've recently found this library <a href="https://github.com/knq/xo">https://github.com/knq/xo</a> that generates idiomatic go code for sql dbs.</p>
<p>From what I see, it generated exactly what's needed, no more, no less. I'm wondering if anyone is actually using this in production or if I should go raw sql. That's a good option to get consistent db code with minimum effort though</p>
<hr/>**评论:**<br/><br/>shovelpost: <pre><p>Looks like a great library. Makes me wonder how it compares to <a href="https://github.com/volatiletech/sqlboiler" rel="nofollow">sqlboiler</a>.</p></pre>natefinch: <pre><p>My problem with sqlboiler is twofold... one, I hate fluent APIs. Two, it doesn't give you any assurances that the code you're writing will actually work....</p>
<pre><code>Where("age > ?", 30)
</code></pre>
<p><sup>^</sup> This is terrible. What if you change the name of the age column? You won't know unless you have tests running against the database. And then you have to manually go find all the places you used the old name and change them to a new name. </p>
<p>It's spewing magic strings all over your codebase. Just say no.</p></pre>shark1337: <pre><p>Wow. This one looks good too!</p></pre>iroflmaowtf: <pre><p>seeing postgres being the star, I must applaud the library</p></pre>natefinch: <pre><p>We're using it at Mattel with extremely customized templates. I really love code generation, so it works well for me.</p>
<p>That being said, I'm also working on my own replacement for it that does things a little differently.</p></pre>brilliantdick: <pre><p><a href="https://github.com/doug-martin/goqu" rel="nofollow">https://github.com/doug-martin/goqu</a> has served me well on multiple go projects when connecting to pg. </p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
0 回复
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传