SODA where子句

编程入门 行业动态 更新时间:2024-10-27 13:33:55
SODA where子句 - 节点中的soda-js(SODA where clause - soda-js in node)

在soda-js包中 ,在src / soda-js.coffee中 ,我发现了以下内容:

# 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)}"

我有一个查询数据的功能:

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?

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

谢谢。

In the soda-js package, in src/soda-js.coffee, I found the following:

# 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)}"

I have a function to query data:

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); }); }

How do I use the where convenience function to query for greater than x?

FYI, I'm trying to query for a floating timestamp greater than a certain value.

Thanks.

最满意答案

当然,我只是想通了。

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); }); }

Of course, I just figured it out.

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); }); }

更多推荐

本文发布于:2023-08-03 07:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1384138.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:子句   SODA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!