UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

45 lines 1.04 kB
import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; import { isNumberParam } from '../utils'; /** * `TEXT` Transforms a number into a string. */ export const TEXT = { identifier: 'TEXT', operationScope: OPERATION_SCOPE.RAW, functionScope: [OPERATION_SCOPE.RAW], parameters: [ { identifier: 'VALUE', optional: false, expectedPrimitive: AST_PRIMITIVES.STRING, validator: [isNumberParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: AST_PRIMITIVES.STRING, }; function elasticsearch(value) { return `TEXT(${value})`; } function SQL(value) { return `${value}::VARCHAR`; } function snowflake(value) { return SQL(value); } function redshift(value) { return SQL(value); } function postgresql(value) { return SQL(value); } function databricks(value) { return `CAST(${value} AS STRING)`; } //# sourceMappingURL=text.js.map