首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >节点中的SODA where子句- soda-js

节点中的SODA where子句- soda-js
EN

Stack Overflow用户
提问于 2017-01-29 06:43:38
回答 1查看 141关注 0票数 1

src/soda-js.coffeesoda-js package中,我发现了以下内容:

代码语言:javascript
复制
# convenience functions for building where clauses, if so desired
expr =
  and: (clauses...) -> ("(#{clause})" for clause in clauses).join(' and ')
  or:  (clauses...) -> ("(#{clause})" for clause in clauses).join(' or ')

  gt:  (column, literal) -> "#{column} > #{handleLiteral(literal)}"
  gte: (column, literal) -> "#{column} >= #{handleLiteral(literal)}"
  lt:  (column, literal) -> "#{column} < #{handleLiteral(literal)}"
  lte: (column, literal) -> "#{column} <= #{handleLiteral(literal)}"
  eq:  (column, literal) -> "#{column} = #{handleLiteral(literal)}"

我有一个查询数据的函数:

代码语言:javascript
复制
function getData() {
    consumer.query()
    .withDataset('emea-ai2t')
    .limit(10000)
    .where() //what do I put here to query greater than x in a column? 
    .getRows()
        .on('success', function(rows) { console.log(rows); })
        .on('error', function(error) { console.error(error); });
}

如何使用where便利性函数查询大于x的值?

仅供参考,我正在尝试查询大于某个特定值的浮点时间戳。

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-29 07:44:50

当然,我只是想通了。

代码语言:javascript
复制
var soda = require('soda-js');

function getData() {
    consumer.query()
    .withDataset('emea-ai2t')
    .limit(10000)
    .where(soda.expr.gt('inc_datetime', '2017-01-26T13:23:00.000'))
    .getRows()
        .on('success', function(rows) { console.log(rows); })
        .on('error', function(error) { console.error(error); });
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41915680

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档