UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

46 lines 1.08 kB
import { dayScript } from '../utils/elasticsearch/scripts'; import { isDateParam } from '../utils'; import { AST_PRIMITIVES, OPERATION_SCOPE } from '../constants'; /** * Returns the number of the DAY in a Date. */ export const DAY = { identifier: 'DAY', operationScope: OPERATION_SCOPE.RAW, functionScope: [OPERATION_SCOPE.RAW], parameters: [ { identifier: 'DATE', optional: false, expectedPrimitive: AST_PRIMITIVES.DATE, validator: [isDateParam], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, databricks, }, primitiveResult: AST_PRIMITIVES.NUMBER, }; function elasticsearch(value) { return dayScript(value); } function SQL(value) { return `DATE_PART('day', ${value})`; } function snowflake(value) { return SQL(value); } function redshift(value) { return SQL(value); } function postgresql(value) { return SQL(value); } function databricks(value) { return SQL(value); } //# sourceMappingURL=day.js.map