@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
28 lines (24 loc) • 610 B
text/typescript
import { INTERVAL } from '../constants.js';
import { ExprNode } from './node.js';
export class IntervalNode extends ExprNode {
/** The interval name. */
readonly name: string;
/** The interval steps. */
readonly steps: number;
/**
* Instantiate an interval node.
* @param name The interval name.
* @param steps The interval steps.
*/
constructor(name: string, steps: number = 1) {
super(INTERVAL);
this.name = name;
this.steps = steps;
}
/**
* Generate a SQL query string for this node.
*/
toString() {
return `INTERVAL ${this.steps} ${this.name}`;
}
}