<p>I have a need to store JSON in a database, but I don't know the best way to do it. I am currently trying to utilise an ORM database, but I'm beginning to think that's a poor way to store JSON with golang. Translating JSON to ORM in golang is terribly difficult as I'm a new golang programmer.</p>
<p>Here is my workflow:
1. Store JSON.
2. Get new JSON.
3. Compare new JSON against stored JSON.
4. Add fields with updated data to stored JSON.
5. Repeat.</p>
<p>What is the most efficient way to store and access the <a href="https://gist.github.com/d6c94f42e51f3e8ee94b" rel="nofollow">JSON data</a> in golang?</p>
<hr/>**评论:**<br/><br/>toolshed51: <pre><p>Postgres recently has added some awesome json features</p>
<p><a href="http://www.postgresql.org/docs/9.4/static/functions-json.html" rel="nofollow">http://www.postgresql.org/docs/9.4/static/functions-json.html</a></p></pre>wholemealbread: <pre><p>Every second db supports JSON like storage now days.</p>
<p>Off the top of my head, mongo, postgresql, rethink and couchdb may be worth looking into.</p></pre>QThellimist: <pre><p>If you want to find examples from the net use mongo. Postgres json is also good, faster than mongo for some important cases but since it's new you won't find lots of examples and things like update are missing in postgresql. You'll have to wait for the new version to come up. Also postgres json queries look so bad :(</p></pre>1spudrocket: <pre><p>I think that MongoDB is a perfect fit for your needs, as it can do exactly that with BSON, but the IO is easy. I created a simple crud example doing exactly this.</p>
<p><a href="https://github.com/andyrees/MgoCRUDExample" rel="nofollow">MongoDB simple CRUD example in Go</a></p></pre>CannedCorn: <pre><p>Also the Golang driver for MongoDB (mgo) is great.</p></pre>Mr_Psmith: <pre><p>couchdb is a native-JSON document database and I think fits the bill exactly =)</p>
<p><a href="http://couchdb.apache.org/" rel="nofollow">http://couchdb.apache.org/</a></p></pre>IntellectualReserve: <pre><p>If you elaborate a bit more on your workflow logic (perhaps with example data), I might be able to offer a better answer. </p>
<p>Depending on what you're trying to do, MongoDB might be able to handle 1,3,4 for you, thereby leaving your app with only having to transform incoming JSON into MongoDB requests.</p></pre>aikah: <pre><p>there is no such thing as a ORM database . An ORM is a library which maps records to objects period.It is not part of the database.</p>
<p>JSON is a serialization format. If you want to dump some JSON documents then there are multiple solutions like MongoDB , CouchDB , CouchBase and plenty others.</p>
<p>Please be accurate. The way you use technical terms inappropriately show you understand very little about databases. </p></pre>nathj07: <pre><p>Ouch, that came off a little snarky. I think the question has led to useful answers. I expect follow up questions that can lead to better understanding.</p></pre>Aangelikaa: <pre><p>Yes, it was a little bit more than snarky ! :) But ...</p>
<p>1) There have been 9 helpful comments out of 10</p>
<p>2) It could have a sort of evolutionary sort of sense, if ppl google just a little bit before posting for help to a highly specialized tek sub.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传