@malloydata/malloy 0.0.39-dev230613161129 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialect/dialect.d.ts +9 -13
- package/dist/dialect/dialect.js +16 -3
- package/dist/dialect/dialect_map.d.ts +2 -0
- package/dist/dialect/dialect_map.js +61 -1
- package/dist/dialect/{duckdb.d.ts → duckdb/duckdb.d.ts} +8 -5
- package/dist/dialect/{duckdb.js → duckdb/duckdb.js} +21 -9
- package/dist/dialect/duckdb/functions/byte_length.d.ts +2 -0
- package/dist/dialect/duckdb/functions/byte_length.js +33 -0
- package/dist/dialect/duckdb/functions/div.d.ts +2 -0
- package/dist/dialect/duckdb/functions/div.js +38 -0
- package/dist/dialect/duckdb/functions/duckdb_functions.d.ts +1 -0
- package/dist/dialect/duckdb/functions/duckdb_functions.js +52 -0
- package/dist/dialect/duckdb/functions/ends_with.d.ts +2 -0
- package/dist/dialect/duckdb/functions/ends_with.js +35 -0
- package/dist/dialect/duckdb/functions/greatest_and_least.d.ts +3 -0
- package/dist/dialect/duckdb/functions/greatest_and_least.js +58 -0
- package/dist/dialect/duckdb/functions/index.d.ts +1 -0
- package/dist/dialect/duckdb/functions/index.js +28 -0
- package/dist/dialect/duckdb/functions/is_inf.d.ts +2 -0
- package/dist/dialect/duckdb/functions/is_inf.js +33 -0
- package/dist/dialect/duckdb/functions/is_nan.d.ts +2 -0
- package/dist/dialect/duckdb/functions/is_nan.js +33 -0
- package/dist/dialect/duckdb/functions/log.d.ts +2 -0
- package/dist/dialect/duckdb/functions/log.js +38 -0
- package/dist/dialect/duckdb/functions/rand.d.ts +2 -0
- package/dist/dialect/duckdb/functions/rand.js +31 -0
- package/dist/dialect/duckdb/functions/replace.d.ts +2 -0
- package/dist/dialect/duckdb/functions/replace.js +40 -0
- package/dist/dialect/duckdb/functions/trunc.d.ts +2 -0
- package/dist/dialect/duckdb/functions/trunc.js +39 -0
- package/dist/dialect/duckdb/functions/unicode.d.ts +2 -0
- package/dist/dialect/duckdb/functions/unicode.js +35 -0
- package/dist/dialect/duckdb/index.d.ts +1 -0
- package/dist/dialect/duckdb/index.js +40 -0
- package/dist/dialect/functions/all_functions.d.ts +8 -0
- package/dist/dialect/functions/all_functions.js +135 -0
- package/dist/dialect/functions/atan2.d.ts +2 -0
- package/dist/dialect/functions/atan2.js +33 -0
- package/dist/dialect/functions/avg_moving.d.ts +2 -0
- package/dist/dialect/functions/avg_moving.js +46 -0
- package/dist/dialect/functions/chr.d.ts +4 -0
- package/dist/dialect/functions/chr.js +45 -0
- package/dist/dialect/functions/coalesce.d.ts +2 -0
- package/dist/dialect/functions/coalesce.js +38 -0
- package/dist/dialect/functions/concat.d.ts +2 -0
- package/dist/dialect/functions/concat.js +38 -0
- package/dist/dialect/functions/div.d.ts +2 -0
- package/dist/dialect/functions/div.js +36 -0
- package/dist/dialect/functions/first_value_window.d.ts +3 -0
- package/dist/dialect/functions/first_value_window.js +49 -0
- package/dist/dialect/functions/function_map.d.ts +16 -0
- package/dist/dialect/functions/function_map.js +50 -0
- package/dist/dialect/functions/greatest_and_least.d.ts +3 -0
- package/dist/dialect/functions/greatest_and_least.js +44 -0
- package/dist/dialect/functions/ifnull.d.ts +2 -0
- package/dist/dialect/functions/ifnull.js +38 -0
- package/dist/dialect/functions/index.d.ts +2 -0
- package/dist/dialect/functions/index.js +28 -0
- package/dist/dialect/functions/is_inf.d.ts +2 -0
- package/dist/dialect/functions/is_inf.js +33 -0
- package/dist/dialect/functions/is_nan.d.ts +2 -0
- package/dist/dialect/functions/is_nan.js +33 -0
- package/dist/dialect/functions/lag.d.ts +2 -0
- package/dist/dialect/functions/lag.js +53 -0
- package/dist/dialect/functions/lead.d.ts +2 -0
- package/dist/dialect/functions/lead.js +50 -0
- package/dist/dialect/functions/length.d.ts +3 -0
- package/dist/dialect/functions/length.js +39 -0
- package/dist/dialect/functions/log.d.ts +2 -0
- package/dist/dialect/functions/log.js +35 -0
- package/dist/dialect/functions/lower.d.ts +2 -0
- package/dist/dialect/functions/lower.js +34 -0
- package/dist/dialect/functions/nullif.d.ts +2 -0
- package/dist/dialect/functions/nullif.js +42 -0
- package/dist/dialect/functions/pi.d.ts +2 -0
- package/dist/{lang/ast/types/type-desc.js → dialect/functions/pi.js} +7 -1
- package/dist/dialect/functions/pow.d.ts +2 -0
- package/dist/dialect/functions/pow.js +35 -0
- package/dist/dialect/functions/rand.d.ts +2 -0
- package/dist/dialect/functions/rand.js +31 -0
- package/dist/dialect/functions/rank.d.ts +2 -0
- package/dist/dialect/functions/rank.js +36 -0
- package/dist/dialect/functions/regexp_extract.d.ts +2 -0
- package/dist/dialect/functions/regexp_extract.js +41 -0
- package/dist/dialect/functions/repeat.d.ts +2 -0
- package/dist/dialect/functions/repeat.js +35 -0
- package/dist/dialect/functions/replace.d.ts +2 -0
- package/dist/dialect/functions/replace.js +42 -0
- package/dist/dialect/functions/reverse.d.ts +2 -0
- package/dist/dialect/functions/reverse.js +34 -0
- package/dist/dialect/functions/round.d.ts +2 -0
- package/dist/dialect/functions/round.js +40 -0
- package/dist/dialect/functions/row_number.d.ts +2 -0
- package/dist/dialect/functions/row_number.js +40 -0
- package/dist/dialect/functions/simple_numeric_functions.d.ts +15 -0
- package/dist/dialect/functions/simple_numeric_functions.js +60 -0
- package/dist/dialect/functions/starts_ends_with.d.ts +3 -0
- package/dist/dialect/functions/starts_ends_with.js +43 -0
- package/dist/dialect/functions/stddev.d.ts +2 -0
- package/dist/dialect/functions/stddev.js +34 -0
- package/dist/dialect/functions/strpos.d.ts +2 -0
- package/dist/dialect/functions/strpos.js +35 -0
- package/dist/dialect/functions/substr.d.ts +2 -0
- package/dist/dialect/functions/substr.js +37 -0
- package/dist/dialect/functions/sum_min_max_window.d.ts +7 -0
- package/dist/dialect/functions/sum_min_max_window.js +94 -0
- package/dist/dialect/functions/trim_functions.d.ts +4 -0
- package/dist/dialect/functions/trim_functions.js +42 -0
- package/dist/dialect/functions/trunc.d.ts +2 -0
- package/dist/dialect/functions/trunc.js +38 -0
- package/dist/dialect/functions/upper.d.ts +2 -0
- package/dist/dialect/functions/upper.js +34 -0
- package/dist/dialect/functions/util.d.ts +45 -0
- package/dist/dialect/functions/util.js +187 -0
- package/dist/dialect/index.d.ts +1 -1
- package/dist/dialect/index.js +2 -1
- package/dist/dialect/postgres/functions/byte_length.d.ts +2 -0
- package/dist/dialect/postgres/functions/byte_length.js +33 -0
- package/dist/dialect/postgres/functions/ends_with.d.ts +2 -0
- package/dist/dialect/postgres/functions/ends_with.js +38 -0
- package/dist/dialect/postgres/functions/greatest_and_least.d.ts +3 -0
- package/dist/dialect/postgres/functions/greatest_and_least.js +45 -0
- package/dist/dialect/postgres/functions/ifnull.d.ts +2 -0
- package/dist/dialect/postgres/functions/ifnull.js +40 -0
- package/dist/dialect/postgres/functions/index.d.ts +1 -0
- package/dist/dialect/postgres/functions/index.js +28 -0
- package/dist/dialect/postgres/functions/is_inf.d.ts +2 -0
- package/dist/dialect/postgres/functions/is_inf.js +34 -0
- package/dist/dialect/postgres/functions/is_nan.d.ts +2 -0
- package/dist/dialect/postgres/functions/is_nan.js +33 -0
- package/dist/dialect/postgres/functions/log.d.ts +2 -0
- package/dist/dialect/postgres/functions/log.js +37 -0
- package/dist/dialect/postgres/functions/postgres_functions.d.ts +1 -0
- package/dist/dialect/postgres/functions/postgres_functions.js +60 -0
- package/dist/dialect/postgres/functions/rand.d.ts +2 -0
- package/dist/dialect/postgres/functions/rand.js +31 -0
- package/dist/dialect/postgres/functions/regexp_extract.d.ts +2 -0
- package/dist/dialect/postgres/functions/regexp_extract.js +35 -0
- package/dist/dialect/postgres/functions/replace.d.ts +2 -0
- package/dist/dialect/postgres/functions/replace.js +40 -0
- package/dist/dialect/postgres/functions/round.d.ts +2 -0
- package/dist/dialect/postgres/functions/round.js +39 -0
- package/dist/dialect/postgres/functions/stddev.d.ts +2 -0
- package/dist/dialect/postgres/functions/stddev.js +37 -0
- package/dist/dialect/postgres/functions/substr.d.ts +2 -0
- package/dist/dialect/postgres/functions/substr.js +38 -0
- package/dist/dialect/postgres/functions/trunc.d.ts +2 -0
- package/dist/dialect/postgres/functions/trunc.js +40 -0
- package/dist/dialect/postgres/functions/unicode.d.ts +2 -0
- package/dist/dialect/postgres/functions/unicode.js +34 -0
- package/dist/dialect/postgres/index.d.ts +1 -0
- package/dist/dialect/postgres/index.js +40 -0
- package/dist/dialect/{postgres.d.ts → postgres/postgres.d.ts} +9 -5
- package/dist/dialect/{postgres.js → postgres/postgres.js} +24 -10
- package/dist/dialect/standardsql/functions/chr.d.ts +2 -0
- package/dist/dialect/standardsql/functions/chr.js +37 -0
- package/dist/dialect/standardsql/functions/index.d.ts +1 -0
- package/dist/dialect/standardsql/functions/index.js +28 -0
- package/dist/dialect/standardsql/functions/pi.d.ts +2 -0
- package/dist/dialect/standardsql/functions/pi.js +32 -0
- package/dist/dialect/standardsql/functions/standardsql_functions.d.ts +1 -0
- package/dist/dialect/standardsql/functions/standardsql_functions.js +33 -0
- package/dist/dialect/standardsql/index.d.ts +1 -0
- package/dist/dialect/standardsql/index.js +40 -0
- package/dist/dialect/{standardsql.d.ts → standardsql/standardsql.d.ts} +7 -4
- package/dist/dialect/{standardsql.js → standardsql/standardsql.js} +13 -11
- package/dist/index.d.ts +1 -1
- package/dist/lang/ast/ast-utils.js +1 -0
- package/dist/lang/ast/elements/define-query.js +1 -1
- package/dist/lang/ast/elements/import-statement.js +6 -1
- package/dist/lang/ast/executors/index-executor.d.ts +1 -1
- package/dist/lang/ast/executors/index-executor.js +2 -2
- package/dist/lang/ast/executors/project-executor.d.ts +1 -1
- package/dist/lang/ast/executors/project-executor.js +2 -2
- package/dist/lang/ast/executors/reduce-executor.d.ts +2 -4
- package/dist/lang/ast/executors/reduce-executor.js +8 -4
- package/dist/lang/ast/expressions/binary-boolean.d.ts +1 -1
- package/dist/lang/ast/expressions/binary-boolean.js +2 -0
- package/dist/lang/ast/expressions/constant-sub-expression.js +10 -0
- package/dist/lang/ast/expressions/expr-aggregate-function.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-aggregate-function.js +28 -2
- package/dist/lang/ast/expressions/expr-alternation-tree.js +1 -0
- package/dist/lang/ast/expressions/expr-cast.js +1 -0
- package/dist/lang/ast/expressions/expr-coalesce.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-coalesce.js +1 -0
- package/dist/lang/ast/expressions/expr-count-distinct.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-count.js +1 -0
- package/dist/lang/ast/expressions/expr-filter.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-filter.js +1 -1
- package/dist/lang/ast/expressions/expr-func.d.ts +6 -1
- package/dist/lang/ast/expressions/expr-func.js +266 -16
- package/dist/lang/ast/expressions/expr-granular-time.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-id-reference.js +12 -0
- package/dist/lang/ast/expressions/expr-logical-op.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-max.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-min.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-not.d.ts +1 -1
- package/dist/lang/ast/expressions/expr-now.js +2 -0
- package/dist/lang/ast/expressions/expr-null.js +1 -0
- package/dist/lang/ast/expressions/expr-number.js +5 -1
- package/dist/lang/ast/expressions/expr-regex.js +4 -1
- package/dist/lang/ast/expressions/expr-string.js +1 -0
- package/dist/lang/ast/expressions/expr-time-extract.js +2 -0
- package/dist/lang/ast/expressions/expr-time.js +1 -0
- package/dist/lang/ast/expressions/expr-ungroup.d.ts +2 -2
- package/dist/lang/ast/expressions/expr-ungroup.js +15 -7
- package/dist/lang/ast/expressions/for-range.d.ts +1 -1
- package/dist/lang/ast/expressions/pick-when.js +7 -0
- package/dist/lang/ast/expressions/range.js +1 -0
- package/dist/lang/ast/expressions/time-literal.js +9 -3
- package/dist/lang/ast/field-space/column-space-field.d.ts +1 -2
- package/dist/lang/ast/field-space/dynamic-space.js +6 -4
- package/dist/lang/ast/field-space/field-definition-value.d.ts +1 -1
- package/dist/lang/ast/field-space/project-field-space.d.ts +2 -2
- package/dist/lang/ast/field-space/project-field-space.js +12 -13
- package/dist/lang/ast/field-space/query-space-field.d.ts +1 -2
- package/dist/lang/ast/field-space/query-space-field.js +1 -1
- package/dist/lang/ast/field-space/query-spaces.d.ts +16 -2
- package/dist/lang/ast/field-space/query-spaces.js +175 -10
- package/dist/lang/ast/field-space/reference-field.d.ts +3 -2
- package/dist/lang/ast/field-space/reference-field.js +8 -1
- package/dist/lang/ast/field-space/rename-space-field.d.ts +1 -2
- package/dist/lang/ast/field-space/static-space.d.ts +4 -3
- package/dist/lang/ast/field-space/static-space.js +4 -0
- package/dist/lang/ast/field-space/struct-space-field-base.d.ts +1 -2
- package/dist/lang/ast/field-space/struct-space-field-base.js +1 -1
- package/dist/lang/ast/field-space/wild-space-field.d.ts +1 -2
- package/dist/lang/ast/fragtype-utils.d.ts +1 -1
- package/dist/lang/ast/fragtype-utils.js +4 -3
- package/dist/lang/ast/index.d.ts +1 -0
- package/dist/lang/ast/index.js +1 -0
- package/dist/lang/ast/query-items/field-declaration.d.ts +40 -4
- package/dist/lang/ast/query-items/field-declaration.js +102 -3
- package/dist/lang/ast/query-items/field-references.d.ts +44 -2
- package/dist/lang/ast/query-items/field-references.js +110 -2
- package/dist/lang/ast/query-items/typecheck_utils.d.ts +10 -0
- package/dist/lang/ast/query-items/typecheck_utils.js +177 -0
- package/dist/lang/ast/query-properties/aggregate.js +0 -6
- package/dist/lang/ast/query-properties/calculate.d.ts +5 -0
- package/dist/lang/ast/query-properties/calculate.js +33 -0
- package/dist/lang/ast/query-properties/dimmensions.js +0 -3
- package/dist/lang/ast/query-properties/filters.js +6 -3
- package/dist/lang/ast/query-properties/group-by.js +0 -6
- package/dist/lang/ast/query-properties/measures.js +0 -3
- package/dist/lang/ast/query-properties/nest-reference.d.ts +2 -0
- package/dist/lang/ast/query-properties/nest-reference.js +23 -0
- package/dist/lang/ast/query-properties/ordering.d.ts +1 -1
- package/dist/lang/ast/query-properties/ordering.js +18 -8
- package/dist/lang/ast/query-properties/qop-desc.js +8 -4
- package/dist/lang/ast/query-properties/top.js +20 -6
- package/dist/lang/ast/sources/named-source.js +4 -0
- package/dist/lang/ast/sources/sql-source.js +5 -1
- package/dist/lang/ast/time-utils.d.ts +1 -2
- package/dist/lang/ast/types/expr-result.d.ts +1 -2
- package/dist/lang/ast/types/expression-def.d.ts +3 -4
- package/dist/lang/ast/types/expression-def.js +10 -2
- package/dist/lang/ast/types/field-space.d.ts +7 -0
- package/dist/lang/ast/types/global-name-space.d.ts +12 -0
- package/dist/lang/ast/types/global-name-space.js +51 -0
- package/dist/lang/ast/types/malloy-element.d.ts +1 -0
- package/dist/lang/ast/types/malloy-element.js +15 -2
- package/dist/lang/ast/types/query-property.d.ts +1 -2
- package/dist/lang/ast/types/query-property.js +2 -0
- package/dist/lang/ast/types/space-entry.d.ts +1 -1
- package/dist/lang/ast/types/space-field.d.ts +1 -2
- package/dist/lang/ast/types/space-field.js +5 -1
- package/dist/lang/ast/types/space-param.d.ts +1 -2
- package/dist/lang/ast/types/space-param.js +10 -2
- package/dist/lang/lib/Malloy/MalloyLexer.d.ts +138 -135
- package/dist/lang/lib/Malloy/MalloyLexer.js +1135 -1103
- package/dist/lang/lib/Malloy/MalloyParser.d.ts +252 -275
- package/dist/lang/lib/Malloy/MalloyParser.js +1753 -1905
- package/dist/lang/lib/Malloy/MalloyParserListener.d.ts +40 -103
- package/dist/lang/lib/Malloy/MalloyParserVisitor.d.ts +25 -64
- package/dist/lang/malloy-to-ast.d.ts +11 -7
- package/dist/lang/malloy-to-ast.js +90 -51
- package/dist/lang/parse-tree-walkers/document-symbol-walker.js +5 -2
- package/dist/lang/test/parse.spec.js +399 -18
- package/dist/lang/test/test-translator.d.ts +1 -0
- package/dist/lang/test/test-translator.js +5 -0
- package/dist/model/malloy_query.d.ts +13 -4
- package/dist/model/malloy_query.js +240 -76
- package/dist/model/malloy_types.d.ts +89 -18
- package/dist/model/malloy_types.js +88 -61
- package/dist/model/utils.d.ts +4 -0
- package/dist/model/utils.js +118 -1
- package/package.json +1 -1
- package/dist/lang/ast/types/type-desc.d.ts +0 -8
|
@@ -22,4 +22,10 @@
|
|
|
22
22
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
|
|
25
|
+
exports.fnPi = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnPi() {
|
|
28
|
+
return [(0, util_1.overload)((0, util_1.minScalar)('number'), [], (0, util_1.sql) `PI()`)];
|
|
29
|
+
}
|
|
30
|
+
exports.fnPi = fnPi;
|
|
31
|
+
//# sourceMappingURL=pi.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnPow = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnPow() {
|
|
28
|
+
const base = (0, util_1.makeParam)('base', (0, util_1.anyExprType)('number'));
|
|
29
|
+
const exponent = (0, util_1.makeParam)('exponent', (0, util_1.anyExprType)('number'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [base.param, exponent.param], (0, util_1.sql) `POW(${base.arg}, ${exponent.arg})`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnPow = fnPow;
|
|
35
|
+
//# sourceMappingURL=pow.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRand = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnRand() {
|
|
28
|
+
return [(0, util_1.overload)((0, util_1.minScalar)('number'), [], (0, util_1.sql) `RAND()`)];
|
|
29
|
+
}
|
|
30
|
+
exports.fnRand = fnRand;
|
|
31
|
+
//# sourceMappingURL=rand.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRank = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
// TODO would you ever want to rank by a different thing than the order by?
|
|
28
|
+
function fnRank() {
|
|
29
|
+
return [
|
|
30
|
+
(0, util_1.overload)((0, util_1.minAnalytic)('number'), [], (0, util_1.sql) `RANK()`, {
|
|
31
|
+
needsWindowOrderBy: true,
|
|
32
|
+
}),
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
exports.fnRank = fnRank;
|
|
36
|
+
//# sourceMappingURL=rank.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRegexpExtract = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnRegexpExtract() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const pattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('regular expression'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [
|
|
32
|
+
value.param,
|
|
33
|
+
pattern.param,
|
|
34
|
+
// TODO consider supporting these parameters
|
|
35
|
+
// param('position', anyExprType('number')),
|
|
36
|
+
// param('occurrence', anyExprType('number')),
|
|
37
|
+
], (0, util_1.sql) `REGEXP_EXTRACT(${value.arg}, ${pattern.arg})`),
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
exports.fnRegexpExtract = fnRegexpExtract;
|
|
41
|
+
//# sourceMappingURL=regexp_extract.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRepeat = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnRepeat() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const count = (0, util_1.makeParam)('count', (0, util_1.anyExprType)('number'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, count.param], (0, util_1.sql) `REPEAT(${value.arg}, ${count.arg})`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnRepeat = fnRepeat;
|
|
35
|
+
//# sourceMappingURL=repeat.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnReplace = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnReplace() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const stringPattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('string'));
|
|
30
|
+
const regexPattern = (0, util_1.makeParam)('pattern', (0, util_1.anyExprType)('regular expression'));
|
|
31
|
+
const replacement = (0, util_1.makeParam)('replacement', (0, util_1.anyExprType)('string'));
|
|
32
|
+
// TODO maybe we need to have a parameter to say whether it's a global replacement or not...
|
|
33
|
+
return [
|
|
34
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, stringPattern.param, replacement.param], (0, util_1.sql) `REPLACE(${value.arg}, ${stringPattern.arg}, ${replacement.arg})`),
|
|
35
|
+
// TODO perhaps this should be a separate `regexp_replace` function.
|
|
36
|
+
// Which would better match BQ, but I think it should be just a different
|
|
37
|
+
// overload of `replace` (how it is here):
|
|
38
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, regexPattern.param, replacement.param], (0, util_1.sql) `REGEXP_REPLACE(${value.arg}, ${regexPattern.arg}, ${replacement.arg})`),
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
exports.fnReplace = fnReplace;
|
|
42
|
+
//# sourceMappingURL=replace.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnReverse = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnReverse() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
return [
|
|
30
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param], (0, util_1.sql) `REVERSE(${value.arg})`),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
exports.fnReverse = fnReverse;
|
|
34
|
+
//# sourceMappingURL=reverse.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRound = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnRound() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('number'));
|
|
29
|
+
// TODO this parameter should only accept integers, but we don't have a good
|
|
30
|
+
// way of expressing that constraint at the moment
|
|
31
|
+
const precision = (0, util_1.makeParam)('precision', (0, util_1.anyExprType)('number'));
|
|
32
|
+
return [
|
|
33
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [value.param], (0, util_1.sql) `ROUND(${value.arg})`),
|
|
34
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [value.param, precision.param], (0, util_1.sql) `ROUND(${value.arg}, ${precision.arg})`),
|
|
35
|
+
// TODO Consider adding a third overload for round(x, y, mode), where
|
|
36
|
+
// "mode" is "ROUND_HALF_AWAY_FROM_ZERO" or "ROUND_HALF_EVEN"
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
exports.fnRound = fnRound;
|
|
40
|
+
//# sourceMappingURL=round.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnRowNumber = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
// TODO here we just assume that the OVER clause just goes right after the
|
|
28
|
+
// generated expression, which isn't necessarily true given the way these overloads
|
|
29
|
+
// work... Theoretically you could write sql`ROW_NUMBER() + 1` and then the OVER would
|
|
30
|
+
// be in the wrong place... It feels like there should be a fragment 'window function'
|
|
31
|
+
// to handle this in a better way...
|
|
32
|
+
function fnRowNumber() {
|
|
33
|
+
return [
|
|
34
|
+
(0, util_1.overload)((0, util_1.minAnalytic)('number'), [], (0, util_1.sql) `ROW_NUMBER()`, {
|
|
35
|
+
needsWindowOrderBy: true,
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
exports.fnRowNumber = fnRowNumber;
|
|
40
|
+
//# sourceMappingURL=row_number.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DialectFunctionOverloadDef } from './util';
|
|
2
|
+
export declare function simple(fn: string): DialectFunctionOverloadDef[];
|
|
3
|
+
export declare const fnCos: () => DialectFunctionOverloadDef[];
|
|
4
|
+
export declare const fnAcos: () => DialectFunctionOverloadDef[];
|
|
5
|
+
export declare const fnSin: () => DialectFunctionOverloadDef[];
|
|
6
|
+
export declare const fnAsin: () => DialectFunctionOverloadDef[];
|
|
7
|
+
export declare const fnTan: () => DialectFunctionOverloadDef[];
|
|
8
|
+
export declare const fnAtan: () => DialectFunctionOverloadDef[];
|
|
9
|
+
export declare const fnSign: () => DialectFunctionOverloadDef[];
|
|
10
|
+
export declare const fnCeil: () => DialectFunctionOverloadDef[];
|
|
11
|
+
export declare const fnFloor: () => DialectFunctionOverloadDef[];
|
|
12
|
+
export declare const fnAbs: () => DialectFunctionOverloadDef[];
|
|
13
|
+
export declare const fnSqrt: () => DialectFunctionOverloadDef[];
|
|
14
|
+
export declare const fnLn: () => DialectFunctionOverloadDef[];
|
|
15
|
+
export declare const fnExp: () => DialectFunctionOverloadDef[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnExp = exports.fnLn = exports.fnSqrt = exports.fnAbs = exports.fnFloor = exports.fnCeil = exports.fnSign = exports.fnAtan = exports.fnTan = exports.fnAsin = exports.fnSin = exports.fnAcos = exports.fnCos = exports.simple = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function simple(fn) {
|
|
28
|
+
return [
|
|
29
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [(0, util_1.param)('value', (0, util_1.anyExprType)('number'))], [(0, util_1.sqlFragment)(`${fn}(`, (0, util_1.arg)('value'), ')')]),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
exports.simple = simple;
|
|
33
|
+
// Trig functions
|
|
34
|
+
const fnCos = () => simple('COS');
|
|
35
|
+
exports.fnCos = fnCos;
|
|
36
|
+
const fnAcos = () => simple('ACOS');
|
|
37
|
+
exports.fnAcos = fnAcos;
|
|
38
|
+
const fnSin = () => simple('SIN');
|
|
39
|
+
exports.fnSin = fnSin;
|
|
40
|
+
const fnAsin = () => simple('ASIN');
|
|
41
|
+
exports.fnAsin = fnAsin;
|
|
42
|
+
const fnTan = () => simple('TAN');
|
|
43
|
+
exports.fnTan = fnTan;
|
|
44
|
+
const fnAtan = () => simple('ATAN');
|
|
45
|
+
exports.fnAtan = fnAtan;
|
|
46
|
+
const fnSign = () => simple('SIGN');
|
|
47
|
+
exports.fnSign = fnSign;
|
|
48
|
+
const fnCeil = () => simple('CEIL');
|
|
49
|
+
exports.fnCeil = fnCeil;
|
|
50
|
+
const fnFloor = () => simple('FLOOR');
|
|
51
|
+
exports.fnFloor = fnFloor;
|
|
52
|
+
const fnAbs = () => simple('ABS');
|
|
53
|
+
exports.fnAbs = fnAbs;
|
|
54
|
+
const fnSqrt = () => simple('SQRT');
|
|
55
|
+
exports.fnSqrt = fnSqrt;
|
|
56
|
+
const fnLn = () => simple('LN');
|
|
57
|
+
exports.fnLn = fnLn;
|
|
58
|
+
const fnExp = () => simple('EXP');
|
|
59
|
+
exports.fnExp = fnExp;
|
|
60
|
+
//# sourceMappingURL=simple_numeric_functions.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnEndsWith = exports.fnStartsWith = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnStartsWith() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const prefix = (0, util_1.makeParam)('prefix', (0, util_1.anyExprType)('string'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('boolean'), [value.param, prefix.param], (0, util_1.sql) `COALESCE(STARTS_WITH(${value.arg}, ${prefix.arg}), false)`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnStartsWith = fnStartsWith;
|
|
35
|
+
function fnEndsWith() {
|
|
36
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
37
|
+
const suffix = (0, util_1.makeParam)('suffix', (0, util_1.anyExprType)('string'));
|
|
38
|
+
return [
|
|
39
|
+
(0, util_1.overload)((0, util_1.minScalar)('boolean'), [value.param, suffix.param], (0, util_1.sql) `COALESCE(ENDS_WITH(${value.arg}, ${suffix.arg}), false)`),
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
exports.fnEndsWith = fnEndsWith;
|
|
43
|
+
//# sourceMappingURL=starts_ends_with.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnStddev = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnStddev() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.maxScalar)('number'));
|
|
29
|
+
return [
|
|
30
|
+
(0, util_1.overload)((0, util_1.minAggregate)('number'), [value.param], (0, util_1.sql) `STDDEV(${value.arg})`),
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
exports.fnStddev = fnStddev;
|
|
34
|
+
//# sourceMappingURL=stddev.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnStrpos = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnStrpos() {
|
|
28
|
+
const testString = (0, util_1.makeParam)('test_string', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const searchString = (0, util_1.makeParam)('search_string', (0, util_1.anyExprType)('string'));
|
|
30
|
+
return [
|
|
31
|
+
(0, util_1.overload)((0, util_1.minScalar)('number'), [testString.param, searchString.param], (0, util_1.sql) `STRPOS(${testString.arg}, ${searchString.arg})`),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
exports.fnStrpos = fnStrpos;
|
|
35
|
+
//# sourceMappingURL=strpos.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
* a copy of this software and associated documentation files
|
|
7
|
+
* (the "Software"), to deal in the Software without restriction,
|
|
8
|
+
* including without limitation the rights to use, copy, modify, merge,
|
|
9
|
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
|
10
|
+
* and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
* subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be
|
|
14
|
+
* included in all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.fnSubstr = void 0;
|
|
26
|
+
const util_1 = require("./util");
|
|
27
|
+
function fnSubstr() {
|
|
28
|
+
const value = (0, util_1.makeParam)('value', (0, util_1.anyExprType)('string'));
|
|
29
|
+
const position = (0, util_1.makeParam)('position', (0, util_1.anyExprType)('number'));
|
|
30
|
+
const length = (0, util_1.makeParam)('length', (0, util_1.anyExprType)('number'));
|
|
31
|
+
return [
|
|
32
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, position.param], (0, util_1.sql) `SUBSTR(${value.arg}, ${position.arg})`),
|
|
33
|
+
(0, util_1.overload)((0, util_1.minScalar)('string'), [value.param, position.param, length.param], (0, util_1.sql) `SUBSTR(${value.arg}, ${position.arg}, ${length.arg})`),
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
exports.fnSubstr = fnSubstr;
|
|
37
|
+
//# sourceMappingURL=substr.js.map
|