UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

58 lines 1.58 kB
import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; import { isBooleanExpression } from '../utils/isBooleanExpression'; /** * `OR` Returns true if any expressions are truthy; otherwise, it will return false. */ export const OR = { identifier: 'OR', operationScope: OPERATION_SCOPE.RAW, functionScope: [OPERATION_SCOPE.RAW, OPERATION_SCOPE.AGGREGATE], recursiveStartIn: 1, parameters: [ { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: true, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: 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