@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
28 lines (24 loc) • 647 B
text/typescript
import { COLLATE } from '../constants.js';
import { ExprNode } from './node.js';
export class CollateNode extends ExprNode {
/** The expression to collate. */
readonly expr: ExprNode;
/** The collation type. */
readonly collation: string;
/**
* Instantiate a collate node.
* @param expr The expression to collate.
* @param collation The collation type.
*/
constructor(expr: ExprNode, collation: string) {
super(COLLATE);
this.expr = expr;
this.collation = collation;
}
/**
* Generate a SQL query string for this node.
*/
toString() {
return `${this.expr} ${COLLATE} ${this.collation}`;
}
}