TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

67 pointsby mglukhovskyover 10 years ago

1 comment

sandstromover 10 years ago
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 未加载