Looking for a database

xuanbao · · 515 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi there, I&#39;m pretty new to Go and I&#39;m looking for a database to use for a project I&#39;m working on. I have a few requirements for it and I haven&#39;t been able to find anything that meets all of them yet.</p> <ul> <li>I would like to be able to interact with it with SQL or something SQL-like.</li> <li>I would like it to persist to disk in a plain-text file in some format that is easy for a human to make sense of (kind of like what Taskwarrior does).</li> <li>I would like it to be pure Go and not require any non-Go dependencies.</li> <li>Performance is NOT a requirement. It won&#39;t hold more than a few hundred objects and does not need to be particularly fast or resource-efficient.</li> </ul> <p>Is there anything like this out there? Thanks!</p> <hr/>**评论:**<br/><br/>gcapell: <pre><p>I worry that although you feel like you don&#39;t need it now, you&#39;ll be sorry later that you didn&#39;t go with some solid (but lightweight) DB. I&#39;d suggest sqlite3 even though it seems like more than you need now.</p></pre>magicjamesv: <pre><p>You might be right, but I&#39;d really like something that writes to human-readable/editable files that users can easily make use of in other programs, pipe around in scripts, etc. if they want to.</p></pre>mwholt: <pre><p>I thought I saw a Go package a while ago that basically does this for CSV files but I can&#39;t find the link right now... (am mobile)</p></pre>magicjamesv: <pre><p>Also, thanks for Caddy! I&#39;ve been using it for about a year now for all my personal projects and love it.</p></pre>magicjamesv: <pre><p>Something like that would be great. In the meantime, I wrote a small package for myself that basically does this with JSON, but if there is an existing package that writes to CSV and is more complete, I&#39;d love to use that instead.</p></pre>megromby: <pre><p>It&#39;s probably <a href="https://github.com/gocarina/gocsv" rel="nofollow">https://github.com/gocarina/gocsv</a></p> <p>Obviously this won&#39;t give you SQL functionality, but with only a few hundred objects you&#39;d probably do just as well to do query/sort/filter/etc. with plain Go.</p></pre>skidooer: <pre><p>More like <a href="https://github.com/dinedal/textql" rel="nofollow">https://github.com/dinedal/textql</a></p> <blockquote> <p>Allows you to easily execute SQL against structured text like CSV or TSV.</p> </blockquote></pre>tormunds_beard: <pre><p>In my experience postgres and go play pretty nicely together, it&#39;s what my project uses. </p></pre>dark_magician2: <pre><p>Have you tried CockroachDB?</p></pre>ecnahc515: <pre><p>Very few things will natively do sql and a plaintext format on disk, largely because most things just implement sql care about performance and thus store things in a way that helps for doing relational queries and doing them fast, which a human readable plain text format is not good for. </p> <p>Sqlite is C and not plain text but can easily give a csv file with a sql query. </p> <p>You could look at textql which may let you build something closer to what you’re looking for. It’s written in Go so you can just reuse some of its packages. </p> <p>Besides that I cannot think of anything that will do what you want without a good amount of effort or compromising. </p></pre>0xjnml: <pre><p>Check <a href="https://godoc.org/go-hep.org/x/hep/csvutil/csvdriver" rel="nofollow">https://godoc.org/go-hep.org/x/hep/csvutil/csvdriver</a></p> <p>It&#39;s a CSV-backend wrapper for <a href="https://github.com/cznic/ql" rel="nofollow">https://github.com/cznic/ql</a></p></pre>

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

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