TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

RethinkDB with io.js: exploring ES6 generators and the future of JavaScript

67 点作者 mglukhovsky超过 10 年前

1 comment

sandstrom超过 10 年前
I like the article, and I look forward to ES6 generators.<p>However, if someone want the compactness of the second example today, CoffeeScript is another alternative:<p><pre><code> conn = undefined r.connect().then (c) -&gt; conn = c r.dbCreate(&#x27;quake&#x27;).run(conn) .then -&gt; r.db(&#x27;quake&#x27;).tableCreate(&#x27;quakes&#x27;).run(conn) .then -&gt; r.db(&#x27;quake&#x27;).table(&#x27;quakes&#x27;) .indexCreate(&#x27;geometry&#x27;, geo: true).run(conn) .then -&gt; r.db(&#x27;quake&#x27;).table(&#x27;quakes&#x27;) .insert(r.http(feedUrl)(&#x27;features&#x27;)).run(conn) .error (err) -&gt; console.log(err) if err.msg.indexOf(&#x27;already exists&#x27;) == -1 .finally -&gt; conn.close() if conn </code></pre> (obviously the main benefits with generators aren&#x27;t concise code, but since the article mentioned conciseness I thought I&#x27;d post the CoffeeScript equivalent)
评论 #8907808 未加载
评论 #8907751 未加载