UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

61 lines 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.OR = void 0; const constants_1 = require("../constants"); const isBooleanExpression_1 = require("../utils/isBooleanExpression"); /** * `OR` Returns true if any expressions are truthy; otherwise, it will return false. */ exports.OR = { identifier: 'OR', operationScope: constants_1.OPERATION_SCOPE.RAW, functionScope: [constants_1.OPERATION_SCOPE.RAW, constants_1.OPERATION_SCOPE.AGGREGATE], recursiveStartIn: 1, parameters: [ { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: constants_1.AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression_1.isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: constants_1.AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression_1.isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: true, expectedPrimitive: constants_1.AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression_1.isBooleanExpression], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: constants_1.AST_PRIMITIVES.BOOLEAN, }; function elasticsearch(...args) { return `(${args.join(' || ')})`; } function sql(...args) { return `(${args.join(' OR ')})`; } function snowflake(...args) { return sql(...args); } function redshift(...args) { return sql(...args); } function postgresql(...args) { return sql(...args); } function databricks(...args) { return sql(...args); } //# sourceMappingURL=or.js.map