Skip to content

DustFoundation/timestream-kit

Repository files navigation

@dustfoundation/timestream-kit

CI NPM Version Minimum Node.js Version

Timestream Kit for fast development.

Installation

npm install --save @dustfoundation/timestream-kit

Usage

Query Builder

QueryBuilder()
  .select('*')
  .fromTable('databaseName', 'tableName')
  .where('id')
  .in([1, 2])
  .and('time')
  .between(new Date('2022-01-01'), new Date('2022-01-02'))
  .and('quantity')
  .greaterThanOrEqual(1)
  .groupBy('id')
  .orderBy('time', 'DESC')
  .build();
// =>
// SELECT * FROM "databaseName"."tableName"
// WHERE id IN (1,2)
// AND time BETWEEN '2022-01-01 00:00:00.000' AND '2022-01-02 00:00:00.000'
// AND quantity >= 1
// GROUP BY id
// ORDER BY time DESC