<hr/>**评论:**<br/><br/>dancannon: <pre><p>Hey, I maintain the Go driver for RethinkDB and while I havnt got anything running in production I hope I have useful information.</p>
<p>Regarding the learning curve as mentioned RethinkDB itself is very beginner friendly for both developers and sysadmins, I find that RethinkDB abstracts away much of the complexity and provides an easy interface through both the query language and the web UI. This is more of an opinion but I also find the functional query language great for working with and the basic compile time checks have helped catch many errors.</p>
<p>The performance of RethinkDB is not quite as good as other similar databases but this is rapidly improving and from what I have seen these performance improvements are not impacting the quality of the rest of the system. I think this is probably a more important point as other databases have tried to focus on performance over data consistency initially and had problems later down the line.</p>
<p>I have also tried to make the Go driver as easy to use as possible, it has come a long way since the initial version (and its predecessor rethinkgo) and now includes some pretty useful features for connecting to RethinkDB clusters of any size. For people who are new to Go the driver can be quite different to the other drivers as Go is statically typed which means that API is slightly different, however once you get used to this difference it is in opinion easier to use than the other drivers.</p>
<p>I hope my answers help, if you (or anybody else) has any other questions let me know!</p></pre>anonxgh: <pre><p>Hi, <a href="/u/dancannon">/u/dancannon</a>. Any plans to make the driver more type safe? Now all <a href="https://godoc.org/github.com/dancannon/gorethink#Term"><code>Term</code></a> methods expect <code>args ...interface{}</code> as arguments. <a href="https://godoc.org/github.com/dancannon/gorethink#DB">E.g.</a>:
<code>
func DB(args ...interface{}) Term
</code>.</p>
<p>While that may be the most straightforward way of implementing RQL, I have a feeling this approach doesn't use the advantage Golang provides: static typing.</p></pre>dancannon: <pre><blockquote>
<p>Hey dan I'm currently trying it it and it's quite fantastic and easy to use, I just have one quick question I can't really find on the docs, when doing an update, is it possible to get the value of the thing that was updated?</p>
</blockquote>
<p>Hey thats a good question, I initially implemented the driver with stricter types however after some testing I realised that due to the fact that ReQL was designed for loosely typed languages that wouldnt really work. </p>
<p>For example the following query is actually valid (I am not saying you should ever do this, it is just valid):</p>
<pre><code>r.DB(r.Expr("tAbleNaMe.").Downcase())
</code></pre>
<p>If I can ever think of a good way of supporting both use cases I will definitely update the driver to be more type safe.</p></pre>anonxgh: <pre><p>Since Golang <a href="https://golang.org/doc/faq#overloading" rel="nofollow">doesn't support</a> function/method overloading, the only solution I can think of is to have a separate method for every type. I.e.:</p>
<ul>
<li><code>func DB(string) Term</code></li>
<li><code>func DBTerm(Term) Term</code></li>
</ul>
<p>P.S.: I have looked into the official Java driver and got a little disappointed.</p>
<pre><code>public Db(Object arg) {
this(new Arguments(arg), null);
}
public Db(Arguments args){
this(args, null);
}
public Db(Arguments args, OptArgs optargs) {
super(TermType.DB, args, optargs);
}
</code></pre>
<p>If I understand correctly, it accepts any type and make all checks on runtime (just as JS driver) throwing exceptions if input arguments are of incorrect type:</p>
<pre><code>// RethinkDB Admin Console: Data Explorer
e: Expected type STRING but found OBJECT in:
r.db({"test": "xxx"})
e: Expected type STRING but found NUMBER in:
r.db(123)
</code></pre>
<p>That's pretty sad.</p></pre>Gacnt: <pre><p>Hey dan I'm currently trying it it and it's quite fantastic and easy to use, I just have one quick question I can't really find on the docs, when doing an update, is it possible to get the value of the thing that was updated?</p>
<p>I'm updating something then wanting to use data from the row, but I'd rather just have it returned from the update rather than 1 from update and 1 from find</p></pre>dancannon: <pre><p>Unfortunately I don't believe it is possible to read the updated document as part of the same operation, this is a limitation of the RethinkDB query language.</p></pre>beefsack: <pre><p>I've built a board gaming by email service using Go and RethinkDB. <a href="https://github.com/dancannon/gorethink">dancannon's driver</a> is very ergonomic and well maintained.</p>
<p>I found it really easy to step into, the RethinkDB web admin is beginner friendly and adding nodes to the cluster is a piece of piss. Performance has been very good for me but we haven't hit crazy scale yet.</p></pre>bmatsuo: <pre><p>Thanks for the review. </p>
<p>TIL "piece of piss" is a good thing. That is a confusing regionalism.</p>
<p>Adding nodes is easy, if people didn't get that.</p></pre>bastawhiz: <pre><p>What kind of data do you think Rethink handles best? I.e., compared to Redis or Couch, or another nontraditional database. </p></pre>codekoala: <pre><p>I used rethinkdb for about a year on a project at work (back in 2013, I think). It's extremely easy to setup and use, and the admin interface is superb. Truly a pleasure to use.</p>
<p>Honestly, though, performance wasn't stellar at the time. We weren't using anything complex in it--we really just wanted a place to keep schemaless metadata. It handled data just fine, but basic retrieval queries took several hundred milliseconds to complete. Eventually we just ditched it and started using postgresql and its fancy json datatype (still using that same setup, just with jsonb now).</p>
<p>Another thing that turned us off of rethinkdb was disk usage. Compared to an un-normalized mysql table with only a primary key index, rethinkdb took almost exactly 32x space on disk (iirc) for the exact same data (irc logs). That got out of hand very quickly.</p>
<p>I'm 100% certain they've made performance improvements since we parted ways. I also know they've made great improvements in the data storage. I've tinkered with rethinkdb since we stopped using it at work. It's really great. But I haven't done any benchmarks since we switched to postgresql. I want to, just haven't had time.</p>
<p>I say try it out!</p></pre>NeilHanlon: <pre><p>Much, much better performance now. I'd check it out again :)</p></pre>dewey4iv: <pre><p>I know we are using it where I work to hold about 80GB of Geo-spatial data and it handles it all like a champ! Is it the fastest thing out there? Nope. But when it comes to managing the DB, scaling, sharding, and recovering from outages I can say it's been the best for us so far. I've found it REALLY useful when I'm starting out a project that may not have a solid DB structure - or one that may well need to evolve over time (though this can be said for other DBs like MongoDB). dancannon (maintainer of gorethink) has been really helpful in helping my sort out a few issues as well and responded SUPER quick (so I think you can expect he'll continue to maintain the driver). I DID have a few little issues (mostly of my own doing) when I wanted to start doing nested queries (joins) but I can show you some of my easy solutions for this if you'd like. Cheers! _G</p></pre>
Has anybody built anything solid with RethinkDB? If so, comments on learning curve / performance ?
agolangf · · 687 次点击这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传