relq 1.0.0
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/LICENSE +21 -0
- package/README.md +862 -0
- package/dist/addons/buffer.js +1869 -0
- package/dist/addons/pg-cursor.js +1425 -0
- package/dist/addons/pg-format.js +2248 -0
- package/dist/addons/pg.js +4790 -0
- package/dist/bin/relq.js +2 -0
- package/dist/cjs/cache/index.cjs +9 -0
- package/dist/cjs/cache/query-cache.cjs +311 -0
- package/dist/cjs/cli/commands/add.cjs +82 -0
- package/dist/cjs/cli/commands/commit.cjs +145 -0
- package/dist/cjs/cli/commands/diff.cjs +84 -0
- package/dist/cjs/cli/commands/export.cjs +333 -0
- package/dist/cjs/cli/commands/fetch.cjs +59 -0
- package/dist/cjs/cli/commands/generate.cjs +242 -0
- package/dist/cjs/cli/commands/history.cjs +165 -0
- package/dist/cjs/cli/commands/import.cjs +524 -0
- package/dist/cjs/cli/commands/init.cjs +437 -0
- package/dist/cjs/cli/commands/introspect.cjs +142 -0
- package/dist/cjs/cli/commands/log.cjs +62 -0
- package/dist/cjs/cli/commands/migrate.cjs +167 -0
- package/dist/cjs/cli/commands/pull.cjs +410 -0
- package/dist/cjs/cli/commands/push.cjs +165 -0
- package/dist/cjs/cli/commands/rollback.cjs +169 -0
- package/dist/cjs/cli/commands/status.cjs +110 -0
- package/dist/cjs/cli/commands/sync.cjs +79 -0
- package/dist/cjs/cli/index.cjs +275 -0
- package/dist/cjs/cli/utils/change-tracker.cjs +446 -0
- package/dist/cjs/cli/utils/commit-manager.cjs +239 -0
- package/dist/cjs/cli/utils/config-loader.cjs +127 -0
- package/dist/cjs/cli/utils/env-loader.cjs +62 -0
- package/dist/cjs/cli/utils/fast-introspect.cjs +398 -0
- package/dist/cjs/cli/utils/git-utils.cjs +404 -0
- package/dist/cjs/cli/utils/migration-generator.cjs +269 -0
- package/dist/cjs/cli/utils/relqignore.cjs +114 -0
- package/dist/cjs/cli/utils/repo-manager.cjs +515 -0
- package/dist/cjs/cli/utils/schema-comparator.cjs +313 -0
- package/dist/cjs/cli/utils/schema-diff.cjs +284 -0
- package/dist/cjs/cli/utils/schema-hash.cjs +108 -0
- package/dist/cjs/cli/utils/schema-introspect.cjs +455 -0
- package/dist/cjs/cli/utils/snapshot-manager.cjs +223 -0
- package/dist/cjs/cli/utils/spinner.cjs +108 -0
- package/dist/cjs/cli/utils/sql-generator.cjs +520 -0
- package/dist/cjs/cli/utils/sql-parser.cjs +999 -0
- package/dist/cjs/cli/utils/type-generator.cjs +2061 -0
- package/dist/cjs/condition/array-condition-builder.cjs +503 -0
- package/dist/cjs/condition/array-numeric-condition-builder.cjs +186 -0
- package/dist/cjs/condition/array-specialized-condition-builder.cjs +206 -0
- package/dist/cjs/condition/array-string-condition-builder.cjs +146 -0
- package/dist/cjs/condition/base-condition-builder.cjs +2 -0
- package/dist/cjs/condition/condition-collector.cjs +284 -0
- package/dist/cjs/condition/fulltext-condition-builder.cjs +61 -0
- package/dist/cjs/condition/geometric-condition-builder.cjs +208 -0
- package/dist/cjs/condition/index.cjs +25 -0
- package/dist/cjs/condition/jsonb-condition-builder.cjs +160 -0
- package/dist/cjs/condition/network-condition-builder.cjs +230 -0
- package/dist/cjs/condition/range-condition-builder.cjs +82 -0
- package/dist/cjs/config/config.cjs +190 -0
- package/dist/cjs/config/index.cjs +9 -0
- package/dist/cjs/constants/pg-values.cjs +68 -0
- package/dist/cjs/copy/copy-builder.cjs +316 -0
- package/dist/cjs/copy/index.cjs +6 -0
- package/dist/cjs/core/query-builder.cjs +440 -0
- package/dist/cjs/core/relq-client.cjs +1831 -0
- package/dist/cjs/core/typed-kuery-client.cjs +2 -0
- package/dist/cjs/count/count-builder.cjs +88 -0
- package/dist/cjs/count/index.cjs +5 -0
- package/dist/cjs/cte/cte-builder.cjs +89 -0
- package/dist/cjs/cte/index.cjs +5 -0
- package/dist/cjs/ddl/function.cjs +48 -0
- package/dist/cjs/ddl/index.cjs +7 -0
- package/dist/cjs/ddl/sql.cjs +54 -0
- package/dist/cjs/delete/delete-builder.cjs +135 -0
- package/dist/cjs/delete/index.cjs +5 -0
- package/dist/cjs/errors/relq-errors.cjs +329 -0
- package/dist/cjs/examples/fulltext-search-test.cjs +122 -0
- package/dist/cjs/explain/explain-builder.cjs +99 -0
- package/dist/cjs/explain/index.cjs +5 -0
- package/dist/cjs/function/create-function-builder.cjs +196 -0
- package/dist/cjs/function/index.cjs +6 -0
- package/dist/cjs/functions/advanced-functions.cjs +241 -0
- package/dist/cjs/functions/case-builder.cjs +66 -0
- package/dist/cjs/functions/geometric-functions.cjs +104 -0
- package/dist/cjs/functions/index.cjs +184 -0
- package/dist/cjs/functions/network-functions.cjs +86 -0
- package/dist/cjs/functions/sql-functions.cjs +431 -0
- package/dist/cjs/index.cjs +164 -0
- package/dist/cjs/indexing/create-index-builder.cjs +187 -0
- package/dist/cjs/indexing/drop-index-builder.cjs +89 -0
- package/dist/cjs/indexing/index-types.cjs +2 -0
- package/dist/cjs/indexing/index.cjs +8 -0
- package/dist/cjs/insert/conflict-builder.cjs +173 -0
- package/dist/cjs/insert/index.cjs +5 -0
- package/dist/cjs/insert/insert-builder.cjs +254 -0
- package/dist/cjs/introspect/index.cjs +229 -0
- package/dist/cjs/maintenance/index.cjs +6 -0
- package/dist/cjs/maintenance/vacuum-builder.cjs +166 -0
- package/dist/cjs/pubsub/index.cjs +7 -0
- package/dist/cjs/pubsub/listen-notify-builder.cjs +57 -0
- package/dist/cjs/pubsub/listener-connection.cjs +180 -0
- package/dist/cjs/raw/index.cjs +5 -0
- package/dist/cjs/raw/raw-query-builder.cjs +27 -0
- package/dist/cjs/schema/index.cjs +15 -0
- package/dist/cjs/schema/schema-builder.cjs +1167 -0
- package/dist/cjs/schema-builder.cjs +21 -0
- package/dist/cjs/schema-definition/column-types.cjs +829 -0
- package/dist/cjs/schema-definition/index.cjs +62 -0
- package/dist/cjs/schema-definition/introspection.cjs +620 -0
- package/dist/cjs/schema-definition/partitions.cjs +129 -0
- package/dist/cjs/schema-definition/pg-enum.cjs +76 -0
- package/dist/cjs/schema-definition/pg-function.cjs +91 -0
- package/dist/cjs/schema-definition/pg-sequence.cjs +56 -0
- package/dist/cjs/schema-definition/pg-trigger.cjs +108 -0
- package/dist/cjs/schema-definition/relations.cjs +98 -0
- package/dist/cjs/schema-definition/sql-expressions.cjs +202 -0
- package/dist/cjs/schema-definition/table-definition.cjs +636 -0
- package/dist/cjs/select/aggregate-builder.cjs +179 -0
- package/dist/cjs/select/index.cjs +5 -0
- package/dist/cjs/select/select-builder.cjs +233 -0
- package/dist/cjs/sequence/index.cjs +7 -0
- package/dist/cjs/sequence/sequence-builder.cjs +264 -0
- package/dist/cjs/table/alter-table-builder.cjs +146 -0
- package/dist/cjs/table/constraint-builder.cjs +102 -0
- package/dist/cjs/table/create-table-builder.cjs +248 -0
- package/dist/cjs/table/index.cjs +17 -0
- package/dist/cjs/table/partition-builder.cjs +131 -0
- package/dist/cjs/table/truncate-builder.cjs +70 -0
- package/dist/cjs/transaction/index.cjs +6 -0
- package/dist/cjs/transaction/transaction-builder.cjs +78 -0
- package/dist/cjs/trigger/create-trigger-builder.cjs +174 -0
- package/dist/cjs/trigger/index.cjs +6 -0
- package/dist/cjs/types/aggregate-types.cjs +2 -0
- package/dist/cjs/types/config-types.cjs +40 -0
- package/dist/cjs/types/inference-types.cjs +18 -0
- package/dist/cjs/types/pagination-types.cjs +7 -0
- package/dist/cjs/types/result-types.cjs +2 -0
- package/dist/cjs/types/schema-types.cjs +2 -0
- package/dist/cjs/types/subscription-types.cjs +2 -0
- package/dist/cjs/types.cjs +2 -0
- package/dist/cjs/update/array-update-builder.cjs +205 -0
- package/dist/cjs/update/index.cjs +13 -0
- package/dist/cjs/update/update-builder.cjs +195 -0
- package/dist/cjs/utils/case-converter.cjs +58 -0
- package/dist/cjs/utils/environment-detection.cjs +120 -0
- package/dist/cjs/utils/index.cjs +10 -0
- package/dist/cjs/utils/pool-defaults.cjs +106 -0
- package/dist/cjs/utils/type-coercion.cjs +118 -0
- package/dist/cjs/view/create-view-builder.cjs +180 -0
- package/dist/cjs/view/index.cjs +7 -0
- package/dist/cjs/window/index.cjs +5 -0
- package/dist/cjs/window/window-builder.cjs +80 -0
- package/dist/config.cjs +1 -0
- package/dist/config.d.ts +655 -0
- package/dist/config.js +1 -0
- package/dist/esm/cache/index.js +1 -0
- package/dist/esm/cache/query-cache.js +303 -0
- package/dist/esm/cli/commands/add.js +78 -0
- package/dist/esm/cli/commands/commit.js +109 -0
- package/dist/esm/cli/commands/diff.js +81 -0
- package/dist/esm/cli/commands/export.js +297 -0
- package/dist/esm/cli/commands/fetch.js +56 -0
- package/dist/esm/cli/commands/generate.js +206 -0
- package/dist/esm/cli/commands/history.js +129 -0
- package/dist/esm/cli/commands/import.js +488 -0
- package/dist/esm/cli/commands/init.js +401 -0
- package/dist/esm/cli/commands/introspect.js +106 -0
- package/dist/esm/cli/commands/log.js +59 -0
- package/dist/esm/cli/commands/migrate.js +131 -0
- package/dist/esm/cli/commands/pull.js +374 -0
- package/dist/esm/cli/commands/push.js +129 -0
- package/dist/esm/cli/commands/rollback.js +133 -0
- package/dist/esm/cli/commands/status.js +107 -0
- package/dist/esm/cli/commands/sync.js +76 -0
- package/dist/esm/cli/index.js +240 -0
- package/dist/esm/cli/utils/change-tracker.js +405 -0
- package/dist/esm/cli/utils/commit-manager.js +191 -0
- package/dist/esm/cli/utils/config-loader.js +86 -0
- package/dist/esm/cli/utils/env-loader.js +57 -0
- package/dist/esm/cli/utils/fast-introspect.js +362 -0
- package/dist/esm/cli/utils/git-utils.js +347 -0
- package/dist/esm/cli/utils/migration-generator.js +263 -0
- package/dist/esm/cli/utils/relqignore.js +74 -0
- package/dist/esm/cli/utils/repo-manager.js +444 -0
- package/dist/esm/cli/utils/schema-comparator.js +307 -0
- package/dist/esm/cli/utils/schema-diff.js +276 -0
- package/dist/esm/cli/utils/schema-hash.js +69 -0
- package/dist/esm/cli/utils/schema-introspect.js +418 -0
- package/dist/esm/cli/utils/snapshot-manager.js +179 -0
- package/dist/esm/cli/utils/spinner.js +101 -0
- package/dist/esm/cli/utils/sql-generator.js +504 -0
- package/dist/esm/cli/utils/sql-parser.js +992 -0
- package/dist/esm/cli/utils/type-generator.js +2058 -0
- package/dist/esm/condition/array-condition-builder.js +495 -0
- package/dist/esm/condition/array-numeric-condition-builder.js +182 -0
- package/dist/esm/condition/array-specialized-condition-builder.js +200 -0
- package/dist/esm/condition/array-string-condition-builder.js +142 -0
- package/dist/esm/condition/base-condition-builder.js +1 -0
- package/dist/esm/condition/condition-collector.js +275 -0
- package/dist/esm/condition/fulltext-condition-builder.js +53 -0
- package/dist/esm/condition/geometric-condition-builder.js +200 -0
- package/dist/esm/condition/index.js +7 -0
- package/dist/esm/condition/jsonb-condition-builder.js +152 -0
- package/dist/esm/condition/network-condition-builder.js +222 -0
- package/dist/esm/condition/range-condition-builder.js +74 -0
- package/dist/esm/config/config.js +150 -0
- package/dist/esm/config/index.js +1 -0
- package/dist/esm/constants/pg-values.js +63 -0
- package/dist/esm/copy/copy-builder.js +308 -0
- package/dist/esm/copy/index.js +1 -0
- package/dist/esm/core/query-builder.js +426 -0
- package/dist/esm/core/relq-client.js +1791 -0
- package/dist/esm/core/typed-kuery-client.js +1 -0
- package/dist/esm/count/count-builder.js +81 -0
- package/dist/esm/count/index.js +1 -0
- package/dist/esm/cte/cte-builder.js +82 -0
- package/dist/esm/cte/index.js +1 -0
- package/dist/esm/ddl/function.js +45 -0
- package/dist/esm/ddl/index.js +2 -0
- package/dist/esm/ddl/sql.js +51 -0
- package/dist/esm/delete/delete-builder.js +128 -0
- package/dist/esm/delete/index.js +1 -0
- package/dist/esm/errors/relq-errors.js +310 -0
- package/dist/esm/examples/fulltext-search-test.js +117 -0
- package/dist/esm/explain/explain-builder.js +95 -0
- package/dist/esm/explain/index.js +1 -0
- package/dist/esm/function/create-function-builder.js +188 -0
- package/dist/esm/function/index.js +1 -0
- package/dist/esm/functions/advanced-functions.js +231 -0
- package/dist/esm/functions/case-builder.js +58 -0
- package/dist/esm/functions/geometric-functions.js +97 -0
- package/dist/esm/functions/index.js +171 -0
- package/dist/esm/functions/network-functions.js +79 -0
- package/dist/esm/functions/sql-functions.js +421 -0
- package/dist/esm/index.js +34 -0
- package/dist/esm/indexing/create-index-builder.js +180 -0
- package/dist/esm/indexing/drop-index-builder.js +81 -0
- package/dist/esm/indexing/index-types.js +1 -0
- package/dist/esm/indexing/index.js +2 -0
- package/dist/esm/insert/conflict-builder.js +162 -0
- package/dist/esm/insert/index.js +1 -0
- package/dist/esm/insert/insert-builder.js +247 -0
- package/dist/esm/introspect/index.js +224 -0
- package/dist/esm/maintenance/index.js +1 -0
- package/dist/esm/maintenance/vacuum-builder.js +158 -0
- package/dist/esm/pubsub/index.js +1 -0
- package/dist/esm/pubsub/listen-notify-builder.js +48 -0
- package/dist/esm/pubsub/listener-connection.js +173 -0
- package/dist/esm/raw/index.js +1 -0
- package/dist/esm/raw/raw-query-builder.js +20 -0
- package/dist/esm/schema/index.js +1 -0
- package/dist/esm/schema/schema-builder.js +1150 -0
- package/dist/esm/schema-builder.js +2 -0
- package/dist/esm/schema-definition/column-types.js +738 -0
- package/dist/esm/schema-definition/index.js +10 -0
- package/dist/esm/schema-definition/introspection.js +614 -0
- package/dist/esm/schema-definition/partitions.js +123 -0
- package/dist/esm/schema-definition/pg-enum.js +70 -0
- package/dist/esm/schema-definition/pg-function.js +85 -0
- package/dist/esm/schema-definition/pg-sequence.js +50 -0
- package/dist/esm/schema-definition/pg-trigger.js +102 -0
- package/dist/esm/schema-definition/relations.js +90 -0
- package/dist/esm/schema-definition/sql-expressions.js +193 -0
- package/dist/esm/schema-definition/table-definition.js +630 -0
- package/dist/esm/select/aggregate-builder.js +172 -0
- package/dist/esm/select/index.js +1 -0
- package/dist/esm/select/select-builder.js +226 -0
- package/dist/esm/sequence/index.js +1 -0
- package/dist/esm/sequence/sequence-builder.js +255 -0
- package/dist/esm/table/alter-table-builder.js +138 -0
- package/dist/esm/table/constraint-builder.js +95 -0
- package/dist/esm/table/create-table-builder.js +241 -0
- package/dist/esm/table/index.js +5 -0
- package/dist/esm/table/partition-builder.js +121 -0
- package/dist/esm/table/truncate-builder.js +63 -0
- package/dist/esm/transaction/index.js +1 -0
- package/dist/esm/transaction/transaction-builder.js +70 -0
- package/dist/esm/trigger/create-trigger-builder.js +166 -0
- package/dist/esm/trigger/index.js +1 -0
- package/dist/esm/types/aggregate-types.js +1 -0
- package/dist/esm/types/config-types.js +36 -0
- package/dist/esm/types/inference-types.js +12 -0
- package/dist/esm/types/pagination-types.js +4 -0
- package/dist/esm/types/result-types.js +1 -0
- package/dist/esm/types/schema-types.js +1 -0
- package/dist/esm/types/subscription-types.js +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/esm/update/array-update-builder.js +192 -0
- package/dist/esm/update/index.js +2 -0
- package/dist/esm/update/update-builder.js +188 -0
- package/dist/esm/utils/case-converter.js +55 -0
- package/dist/esm/utils/environment-detection.js +113 -0
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/pool-defaults.js +100 -0
- package/dist/esm/utils/type-coercion.js +110 -0
- package/dist/esm/view/create-view-builder.js +171 -0
- package/dist/esm/view/index.js +1 -0
- package/dist/esm/window/index.js +1 -0
- package/dist/esm/window/window-builder.js +73 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +10341 -0
- package/dist/index.js +1 -0
- package/dist/schema-builder.cjs +1 -0
- package/dist/schema-builder.d.ts +2272 -0
- package/dist/schema-builder.js +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Math = exports.DateTime = exports.String = exports.MathFunctions = exports.DateTimeFunctions = exports.StringFunctions = exports.SqlFunction = void 0;
|
|
7
|
+
const pg_format_1 = __importDefault(require("../../addons/pg-format.js"));
|
|
8
|
+
class SqlFunction {
|
|
9
|
+
expression;
|
|
10
|
+
constructor(expression) {
|
|
11
|
+
this.expression = expression;
|
|
12
|
+
}
|
|
13
|
+
as(alias) {
|
|
14
|
+
return `${this.expression} AS ${pg_format_1.default.ident(alias)}`;
|
|
15
|
+
}
|
|
16
|
+
toString() {
|
|
17
|
+
return this.expression;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.SqlFunction = SqlFunction;
|
|
21
|
+
class StringFunctions {
|
|
22
|
+
static concat(...values) {
|
|
23
|
+
const args = values.map(v => typeof v === 'string' && v.includes('.') || /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)
|
|
24
|
+
? pg_format_1.default.ident(v)
|
|
25
|
+
: (0, pg_format_1.default)('%L', v)).join(', ');
|
|
26
|
+
return new SqlFunction(`concat(${args})`);
|
|
27
|
+
}
|
|
28
|
+
static concat_ws(separator, ...values) {
|
|
29
|
+
const sep = (0, pg_format_1.default)('%L', separator);
|
|
30
|
+
const args = values.map(v => typeof v === 'string' && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)
|
|
31
|
+
? pg_format_1.default.ident(v)
|
|
32
|
+
: (0, pg_format_1.default)('%L', v)).join(', ');
|
|
33
|
+
return new SqlFunction(`concat_ws(${sep}, ${args})`);
|
|
34
|
+
}
|
|
35
|
+
static lower(value) {
|
|
36
|
+
return new SqlFunction((0, pg_format_1.default)('lower(%I)', value));
|
|
37
|
+
}
|
|
38
|
+
static upper(value) {
|
|
39
|
+
return new SqlFunction((0, pg_format_1.default)('upper(%I)', value));
|
|
40
|
+
}
|
|
41
|
+
static initcap(value) {
|
|
42
|
+
return new SqlFunction((0, pg_format_1.default)('initcap(%I)', value));
|
|
43
|
+
}
|
|
44
|
+
static substring(str, start, length) {
|
|
45
|
+
const args = length
|
|
46
|
+
? (0, pg_format_1.default)('%I, %s, %s', str, start, length)
|
|
47
|
+
: (0, pg_format_1.default)('%I, %s', str, start);
|
|
48
|
+
return new SqlFunction(`substring(${args})`);
|
|
49
|
+
}
|
|
50
|
+
static substr(str, start, length) {
|
|
51
|
+
return this.substring(str, start, length);
|
|
52
|
+
}
|
|
53
|
+
static strLength(value) {
|
|
54
|
+
return new SqlFunction((0, pg_format_1.default)('length(%I)', value));
|
|
55
|
+
}
|
|
56
|
+
static char_length(value) {
|
|
57
|
+
return new SqlFunction((0, pg_format_1.default)('char_length(%I)', value));
|
|
58
|
+
}
|
|
59
|
+
static octet_length(value) {
|
|
60
|
+
return new SqlFunction((0, pg_format_1.default)('octet_length(%I)', value));
|
|
61
|
+
}
|
|
62
|
+
static bit_length(value) {
|
|
63
|
+
return new SqlFunction((0, pg_format_1.default)('bit_length(%I)', value));
|
|
64
|
+
}
|
|
65
|
+
static trim(str, chars, side = 'both') {
|
|
66
|
+
if (chars) {
|
|
67
|
+
const sideStr = side === 'both' ? 'BOTH' : side === 'leading' ? 'LEADING' : 'TRAILING';
|
|
68
|
+
return new SqlFunction((0, pg_format_1.default)(`trim(${sideStr} %L FROM %I)`, chars, str));
|
|
69
|
+
}
|
|
70
|
+
return new SqlFunction((0, pg_format_1.default)('trim(%I)', str));
|
|
71
|
+
}
|
|
72
|
+
static ltrim(str, chars) {
|
|
73
|
+
if (chars) {
|
|
74
|
+
return new SqlFunction((0, pg_format_1.default)('ltrim(%I, %L)', str, chars));
|
|
75
|
+
}
|
|
76
|
+
return new SqlFunction((0, pg_format_1.default)('ltrim(%I)', str));
|
|
77
|
+
}
|
|
78
|
+
static rtrim(str, chars) {
|
|
79
|
+
if (chars) {
|
|
80
|
+
return new SqlFunction((0, pg_format_1.default)('rtrim(%I, %L)', str, chars));
|
|
81
|
+
}
|
|
82
|
+
return new SqlFunction((0, pg_format_1.default)('rtrim(%I)', str));
|
|
83
|
+
}
|
|
84
|
+
static btrim(str, chars) {
|
|
85
|
+
return this.trim(str, chars, 'both');
|
|
86
|
+
}
|
|
87
|
+
static position(substring, str) {
|
|
88
|
+
return new SqlFunction((0, pg_format_1.default)('position(%L IN %I)', substring, str));
|
|
89
|
+
}
|
|
90
|
+
static strpos(str, substring) {
|
|
91
|
+
return new SqlFunction((0, pg_format_1.default)('strpos(%I, %L)', str, substring));
|
|
92
|
+
}
|
|
93
|
+
static replace(str, from, to) {
|
|
94
|
+
return new SqlFunction((0, pg_format_1.default)('replace(%I, %L, %L)', str, from, to));
|
|
95
|
+
}
|
|
96
|
+
static translate(str, from, to) {
|
|
97
|
+
return new SqlFunction((0, pg_format_1.default)('translate(%I, %L, %L)', str, from, to));
|
|
98
|
+
}
|
|
99
|
+
static repeat(str, n) {
|
|
100
|
+
return new SqlFunction((0, pg_format_1.default)('repeat(%I, %s)', str, n));
|
|
101
|
+
}
|
|
102
|
+
static lpad(str, length, fill = ' ') {
|
|
103
|
+
return new SqlFunction((0, pg_format_1.default)('lpad(%I, %s, %L)', str, length, fill));
|
|
104
|
+
}
|
|
105
|
+
static rpad(str, length, fill = ' ') {
|
|
106
|
+
return new SqlFunction((0, pg_format_1.default)('rpad(%I, %s, %L)', str, length, fill));
|
|
107
|
+
}
|
|
108
|
+
static reverse(str) {
|
|
109
|
+
return new SqlFunction((0, pg_format_1.default)('reverse(%I)', str));
|
|
110
|
+
}
|
|
111
|
+
static split_part(str, delimiter, position) {
|
|
112
|
+
return new SqlFunction((0, pg_format_1.default)('split_part(%I, %L, %s)', str, delimiter, position));
|
|
113
|
+
}
|
|
114
|
+
static regexp_match(str, pattern, flags) {
|
|
115
|
+
if (flags) {
|
|
116
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_match(%I, %L, %L)', str, pattern, flags));
|
|
117
|
+
}
|
|
118
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_match(%I, %L)', str, pattern));
|
|
119
|
+
}
|
|
120
|
+
static regexp_matches(str, pattern, flags) {
|
|
121
|
+
if (flags) {
|
|
122
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_matches(%I, %L, %L)', str, pattern, flags));
|
|
123
|
+
}
|
|
124
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_matches(%I, %L)', str, pattern));
|
|
125
|
+
}
|
|
126
|
+
static regexp_replace(str, pattern, replacement, flags) {
|
|
127
|
+
if (flags) {
|
|
128
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_replace(%I, %L, %L, %L)', str, pattern, replacement, flags));
|
|
129
|
+
}
|
|
130
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_replace(%I, %L, %L)', str, pattern, replacement));
|
|
131
|
+
}
|
|
132
|
+
static regexp_split_to_array(str, pattern, flags) {
|
|
133
|
+
if (flags) {
|
|
134
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_split_to_array(%I, %L, %L)', str, pattern, flags));
|
|
135
|
+
}
|
|
136
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_split_to_array(%I, %L)', str, pattern));
|
|
137
|
+
}
|
|
138
|
+
static regexp_split_to_table(str, pattern, flags) {
|
|
139
|
+
if (flags) {
|
|
140
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_split_to_table(%I, %L, %L)', str, pattern, flags));
|
|
141
|
+
}
|
|
142
|
+
return new SqlFunction((0, pg_format_1.default)('regexp_split_to_table(%I, %L)', str, pattern));
|
|
143
|
+
}
|
|
144
|
+
static encode(data, fmt) {
|
|
145
|
+
return new SqlFunction((0, pg_format_1.default)('encode(%I, %L)', data, fmt));
|
|
146
|
+
}
|
|
147
|
+
static decode(data, fmt) {
|
|
148
|
+
return new SqlFunction((0, pg_format_1.default)('decode(%I, %L)', data, fmt));
|
|
149
|
+
}
|
|
150
|
+
static md5(str) {
|
|
151
|
+
return new SqlFunction((0, pg_format_1.default)('md5(%I)', str));
|
|
152
|
+
}
|
|
153
|
+
static ascii(str) {
|
|
154
|
+
return new SqlFunction((0, pg_format_1.default)('ascii(%I)', str));
|
|
155
|
+
}
|
|
156
|
+
static chr(code) {
|
|
157
|
+
return new SqlFunction(`chr(${code})`);
|
|
158
|
+
}
|
|
159
|
+
static to_hex(num) {
|
|
160
|
+
const arg = typeof num === 'string' ? pg_format_1.default.ident(num) : num;
|
|
161
|
+
return new SqlFunction(`to_hex(${arg})`);
|
|
162
|
+
}
|
|
163
|
+
static lpad_zero(str, width) {
|
|
164
|
+
return new SqlFunction((0, pg_format_1.default)('lpad(%I, %s, \'0\')', str, width));
|
|
165
|
+
}
|
|
166
|
+
static format(formatStr, ...values) {
|
|
167
|
+
const args = [(0, pg_format_1.default)('%L', formatStr), ...values.map(v => typeof v === 'string' && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)
|
|
168
|
+
? pg_format_1.default.ident(v)
|
|
169
|
+
: (0, pg_format_1.default)('%L', v))].join(', ');
|
|
170
|
+
return new SqlFunction(`format(${args})`);
|
|
171
|
+
}
|
|
172
|
+
static quote_ident(str) {
|
|
173
|
+
return new SqlFunction((0, pg_format_1.default)('quote_ident(%I)', str));
|
|
174
|
+
}
|
|
175
|
+
static quote_literal(str) {
|
|
176
|
+
return new SqlFunction((0, pg_format_1.default)('quote_literal(%I)', str));
|
|
177
|
+
}
|
|
178
|
+
static quote_nullable(str) {
|
|
179
|
+
return new SqlFunction((0, pg_format_1.default)('quote_nullable(%I)', str));
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
exports.StringFunctions = StringFunctions;
|
|
183
|
+
exports.String = StringFunctions;
|
|
184
|
+
class DateTimeFunctions {
|
|
185
|
+
static now() {
|
|
186
|
+
return new SqlFunction('now()');
|
|
187
|
+
}
|
|
188
|
+
static current_date() {
|
|
189
|
+
return new SqlFunction('CURRENT_DATE');
|
|
190
|
+
}
|
|
191
|
+
static current_time() {
|
|
192
|
+
return new SqlFunction('CURRENT_TIME');
|
|
193
|
+
}
|
|
194
|
+
static current_timestamp() {
|
|
195
|
+
return new SqlFunction('CURRENT_TIMESTAMP');
|
|
196
|
+
}
|
|
197
|
+
static transaction_timestamp() {
|
|
198
|
+
return new SqlFunction('transaction_timestamp()');
|
|
199
|
+
}
|
|
200
|
+
static statement_timestamp() {
|
|
201
|
+
return new SqlFunction('statement_timestamp()');
|
|
202
|
+
}
|
|
203
|
+
static clock_timestamp() {
|
|
204
|
+
return new SqlFunction('clock_timestamp()');
|
|
205
|
+
}
|
|
206
|
+
static localtimestamp() {
|
|
207
|
+
return new SqlFunction('localtimestamp');
|
|
208
|
+
}
|
|
209
|
+
static date_trunc(field, source) {
|
|
210
|
+
return new SqlFunction((0, pg_format_1.default)('date_trunc(%L, %I)', field, source));
|
|
211
|
+
}
|
|
212
|
+
static extract(field, source) {
|
|
213
|
+
return new SqlFunction((0, pg_format_1.default)('extract(%s FROM %I)', field.toUpperCase(), source));
|
|
214
|
+
}
|
|
215
|
+
static date_part(field, source) {
|
|
216
|
+
return new SqlFunction((0, pg_format_1.default)('date_part(%L, %I)', field, source));
|
|
217
|
+
}
|
|
218
|
+
static age(timestamp1, timestamp2) {
|
|
219
|
+
if (timestamp2) {
|
|
220
|
+
return new SqlFunction((0, pg_format_1.default)('age(%I, %I)', timestamp1, timestamp2));
|
|
221
|
+
}
|
|
222
|
+
return new SqlFunction((0, pg_format_1.default)('age(%I)', timestamp1));
|
|
223
|
+
}
|
|
224
|
+
static make_date(year, month, day) {
|
|
225
|
+
const y = typeof year === 'string' ? pg_format_1.default.ident(year) : year;
|
|
226
|
+
const m = typeof month === 'string' ? pg_format_1.default.ident(month) : month;
|
|
227
|
+
const d = typeof day === 'string' ? pg_format_1.default.ident(day) : day;
|
|
228
|
+
return new SqlFunction(`make_date(${y}, ${m}, ${d})`);
|
|
229
|
+
}
|
|
230
|
+
static make_time(hour, min, sec) {
|
|
231
|
+
const h = typeof hour === 'string' ? pg_format_1.default.ident(hour) : hour;
|
|
232
|
+
const m = typeof min === 'string' ? pg_format_1.default.ident(min) : min;
|
|
233
|
+
const s = typeof sec === 'string' ? pg_format_1.default.ident(sec) : sec;
|
|
234
|
+
return new SqlFunction(`make_time(${h}, ${m}, ${s})`);
|
|
235
|
+
}
|
|
236
|
+
static make_timestamp(year, month, day, hour, min, sec) {
|
|
237
|
+
const args = [year, month, day, hour, min, sec].map(v => typeof v === 'string' ? pg_format_1.default.ident(v) : v).join(', ');
|
|
238
|
+
return new SqlFunction(`make_timestamp(${args})`);
|
|
239
|
+
}
|
|
240
|
+
static make_interval(years, months, weeks, days, hours, mins, secs) {
|
|
241
|
+
const parts = [];
|
|
242
|
+
if (years !== undefined)
|
|
243
|
+
parts.push(`years => ${years}`);
|
|
244
|
+
if (months !== undefined)
|
|
245
|
+
parts.push(`months => ${months}`);
|
|
246
|
+
if (weeks !== undefined)
|
|
247
|
+
parts.push(`weeks => ${weeks}`);
|
|
248
|
+
if (days !== undefined)
|
|
249
|
+
parts.push(`days => ${days}`);
|
|
250
|
+
if (hours !== undefined)
|
|
251
|
+
parts.push(`hours => ${hours}`);
|
|
252
|
+
if (mins !== undefined)
|
|
253
|
+
parts.push(`mins => ${mins}`);
|
|
254
|
+
if (secs !== undefined)
|
|
255
|
+
parts.push(`secs => ${secs}`);
|
|
256
|
+
return new SqlFunction(`make_interval(${parts.join(', ')})`);
|
|
257
|
+
}
|
|
258
|
+
static to_timestamp(unixTimestamp) {
|
|
259
|
+
const arg = typeof unixTimestamp === 'string' ? pg_format_1.default.ident(unixTimestamp) : unixTimestamp;
|
|
260
|
+
return new SqlFunction(`to_timestamp(${arg})`);
|
|
261
|
+
}
|
|
262
|
+
static to_timestamp_format(text, formatPattern) {
|
|
263
|
+
return new SqlFunction((0, pg_format_1.default)('to_timestamp(%I, %L)', text, formatPattern));
|
|
264
|
+
}
|
|
265
|
+
static to_date(text, formatPattern) {
|
|
266
|
+
return new SqlFunction((0, pg_format_1.default)('to_date(%I, %L)', text, formatPattern));
|
|
267
|
+
}
|
|
268
|
+
static to_char(timestamp, formatPattern) {
|
|
269
|
+
return new SqlFunction((0, pg_format_1.default)('to_char(%I, %L)', timestamp, formatPattern));
|
|
270
|
+
}
|
|
271
|
+
static timezone(timestamp, timezone) {
|
|
272
|
+
return new SqlFunction((0, pg_format_1.default)('timezone(%L, %I)', timezone, timestamp));
|
|
273
|
+
}
|
|
274
|
+
static justify_days(interval) {
|
|
275
|
+
return new SqlFunction((0, pg_format_1.default)('justify_days(%I)', interval));
|
|
276
|
+
}
|
|
277
|
+
static justify_hours(interval) {
|
|
278
|
+
return new SqlFunction((0, pg_format_1.default)('justify_hours(%I)', interval));
|
|
279
|
+
}
|
|
280
|
+
static justify_interval(interval) {
|
|
281
|
+
return new SqlFunction((0, pg_format_1.default)('justify_interval(%I)', interval));
|
|
282
|
+
}
|
|
283
|
+
static isfinite(date) {
|
|
284
|
+
return new SqlFunction((0, pg_format_1.default)('isfinite(%I)', date));
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
exports.DateTimeFunctions = DateTimeFunctions;
|
|
288
|
+
exports.DateTime = DateTimeFunctions;
|
|
289
|
+
class MathFunctions {
|
|
290
|
+
static abs(x) {
|
|
291
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
292
|
+
return new SqlFunction(`abs(${arg})`);
|
|
293
|
+
}
|
|
294
|
+
static sign(x) {
|
|
295
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
296
|
+
return new SqlFunction(`sign(${arg})`);
|
|
297
|
+
}
|
|
298
|
+
static ceil(x) {
|
|
299
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
300
|
+
return new SqlFunction(`ceil(${arg})`);
|
|
301
|
+
}
|
|
302
|
+
static ceiling(x) {
|
|
303
|
+
return this.ceil(x);
|
|
304
|
+
}
|
|
305
|
+
static floor(x) {
|
|
306
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
307
|
+
return new SqlFunction(`floor(${arg})`);
|
|
308
|
+
}
|
|
309
|
+
static round(x, decimals = 0) {
|
|
310
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
311
|
+
return new SqlFunction(`round(${arg}, ${decimals})`);
|
|
312
|
+
}
|
|
313
|
+
static trunc(x, decimals = 0) {
|
|
314
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
315
|
+
return new SqlFunction(`trunc(${arg}, ${decimals})`);
|
|
316
|
+
}
|
|
317
|
+
static mod(dividend, divisor) {
|
|
318
|
+
const arg = typeof dividend === 'string' ? pg_format_1.default.ident(dividend) : dividend;
|
|
319
|
+
return new SqlFunction(`mod(${arg}, ${divisor})`);
|
|
320
|
+
}
|
|
321
|
+
static div(dividend, divisor) {
|
|
322
|
+
const arg = typeof dividend === 'string' ? pg_format_1.default.ident(dividend) : dividend;
|
|
323
|
+
return new SqlFunction(`div(${arg}, ${divisor})`);
|
|
324
|
+
}
|
|
325
|
+
static power(x, y) {
|
|
326
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
327
|
+
return new SqlFunction(`power(${arg}, ${y})`);
|
|
328
|
+
}
|
|
329
|
+
static sqrt(x) {
|
|
330
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
331
|
+
return new SqlFunction(`sqrt(${arg})`);
|
|
332
|
+
}
|
|
333
|
+
static cbrt(x) {
|
|
334
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
335
|
+
return new SqlFunction(`cbrt(${arg})`);
|
|
336
|
+
}
|
|
337
|
+
static exp(x) {
|
|
338
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
339
|
+
return new SqlFunction(`exp(${arg})`);
|
|
340
|
+
}
|
|
341
|
+
static ln(x) {
|
|
342
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
343
|
+
return new SqlFunction(`ln(${arg})`);
|
|
344
|
+
}
|
|
345
|
+
static log10(x) {
|
|
346
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
347
|
+
return new SqlFunction(`log10(${arg})`);
|
|
348
|
+
}
|
|
349
|
+
static log(base, x) {
|
|
350
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
351
|
+
return new SqlFunction(`log(${base}, ${arg})`);
|
|
352
|
+
}
|
|
353
|
+
static pi() {
|
|
354
|
+
return new SqlFunction('pi()');
|
|
355
|
+
}
|
|
356
|
+
static degrees(radians) {
|
|
357
|
+
const arg = typeof radians === 'string' ? pg_format_1.default.ident(radians) : radians;
|
|
358
|
+
return new SqlFunction(`degrees(${arg})`);
|
|
359
|
+
}
|
|
360
|
+
static radians(degrees) {
|
|
361
|
+
const arg = typeof degrees === 'string' ? pg_format_1.default.ident(degrees) : degrees;
|
|
362
|
+
return new SqlFunction(`radians(${arg})`);
|
|
363
|
+
}
|
|
364
|
+
static sin(x) {
|
|
365
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
366
|
+
return new SqlFunction(`sin(${arg})`);
|
|
367
|
+
}
|
|
368
|
+
static cos(x) {
|
|
369
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
370
|
+
return new SqlFunction(`cos(${arg})`);
|
|
371
|
+
}
|
|
372
|
+
static tan(x) {
|
|
373
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
374
|
+
return new SqlFunction(`tan(${arg})`);
|
|
375
|
+
}
|
|
376
|
+
static asin(x) {
|
|
377
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
378
|
+
return new SqlFunction(`asin(${arg})`);
|
|
379
|
+
}
|
|
380
|
+
static acos(x) {
|
|
381
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
382
|
+
return new SqlFunction(`acos(${arg})`);
|
|
383
|
+
}
|
|
384
|
+
static atan(x) {
|
|
385
|
+
const arg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
386
|
+
return new SqlFunction(`atan(${arg})`);
|
|
387
|
+
}
|
|
388
|
+
static atan2(y, x) {
|
|
389
|
+
const yArg = typeof y === 'string' ? pg_format_1.default.ident(y) : y;
|
|
390
|
+
const xArg = typeof x === 'string' ? pg_format_1.default.ident(x) : x;
|
|
391
|
+
return new SqlFunction(`atan2(${yArg}, ${xArg})`);
|
|
392
|
+
}
|
|
393
|
+
static random() {
|
|
394
|
+
return new SqlFunction('random()');
|
|
395
|
+
}
|
|
396
|
+
static setseed(seed) {
|
|
397
|
+
return new SqlFunction(`setseed(${seed})`);
|
|
398
|
+
}
|
|
399
|
+
static gcd(a, b) {
|
|
400
|
+
const aArg = typeof a === 'string' ? pg_format_1.default.ident(a) : a;
|
|
401
|
+
const bArg = typeof b === 'string' ? pg_format_1.default.ident(b) : b;
|
|
402
|
+
return new SqlFunction(`gcd(${aArg}, ${bArg})`);
|
|
403
|
+
}
|
|
404
|
+
static lcm(a, b) {
|
|
405
|
+
const aArg = typeof a === 'string' ? pg_format_1.default.ident(a) : a;
|
|
406
|
+
const bArg = typeof b === 'string' ? pg_format_1.default.ident(b) : b;
|
|
407
|
+
return new SqlFunction(`lcm(${aArg}, ${bArg})`);
|
|
408
|
+
}
|
|
409
|
+
static factorial(n) {
|
|
410
|
+
const arg = typeof n === 'string' ? pg_format_1.default.ident(n) : n;
|
|
411
|
+
return new SqlFunction(`factorial(${arg})`);
|
|
412
|
+
}
|
|
413
|
+
static greatest(...values) {
|
|
414
|
+
const args = values.map(v => typeof v === 'string' && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)
|
|
415
|
+
? pg_format_1.default.ident(v)
|
|
416
|
+
: (0, pg_format_1.default)('%L', v)).join(', ');
|
|
417
|
+
return new SqlFunction(`greatest(${args})`);
|
|
418
|
+
}
|
|
419
|
+
static least(...values) {
|
|
420
|
+
const args = values.map(v => typeof v === 'string' && /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(v)
|
|
421
|
+
? pg_format_1.default.ident(v)
|
|
422
|
+
: (0, pg_format_1.default)('%L', v)).join(', ');
|
|
423
|
+
return new SqlFunction(`least(${args})`);
|
|
424
|
+
}
|
|
425
|
+
static width_bucket(operand, min, max, count) {
|
|
426
|
+
const arg = typeof operand === 'string' ? pg_format_1.default.ident(operand) : operand;
|
|
427
|
+
return new SqlFunction(`width_bucket(${arg}, ${min}, ${max}, ${count})`);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
exports.MathFunctions = MathFunctions;
|
|
431
|
+
exports.Math = MathFunctions;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.DropTriggerBuilder = exports.CreateTriggerBuilder = exports.TruncateBuilder = exports.DetachPartitionBuilder = exports.AttachPartitionBuilder = exports.CreatePartitionBuilder = exports.PartitionBuilder = exports.ConstraintBuilder = exports.DropTableBuilder = exports.AlterTableBuilder = exports.CreateTableBuilder = exports.ReindexBuilder = exports.DropIndexBuilder = exports.CreateIndexBuilder = exports.formatPoolConfig = exports.mergeWithDefaults = exports.validatePoolConfig = exports.getSmartPoolDefaults = exports.getEnvironmentDescription = exports.isEdge = exports.isTraditional = exports.isServerless = exports.detectEnvironment = exports.setupErrorHandler = exports.parsePostgresError = exports.wrapError = exports.isRelqBuilderError = exports.isRelqQueryError = exports.isRelqConnectionError = exports.isRelqError = exports.RelqBuilderError = exports.RelqEnvironmentError = exports.RelqPoolError = exports.RelqTimeoutError = exports.RelqConfigError = exports.RelqTransactionError = exports.RelqQueryError = exports.RelqConnectionError = exports.RelqError = exports.RelqClient = exports.Relq = exports.relqFor = exports.TypedCountBuilder = exports.TypedDeleteBuilder = exports.TypedUpdateBuilder = exports.TypedInsertBuilder = exports.TypedSelectBuilder = exports.QueryBuilder = exports.default = exports.relq = void 0;
|
|
21
|
+
exports.StringFunctions = exports.SqlFunction = exports.F = exports.RawValue = exports.PG = exports.PgValue = exports.format = exports.convertCase = exports.createTableCache = exports.withCache = exports.createQueryCacheMiddleware = exports.CacheKeyBuilder = exports.QueryCache = exports.CopyFromBuilder = exports.CopyToBuilder = exports.AnalyzeBuilder = exports.VacuumBuilder = exports.NotifyBuilder = exports.UnlistenBuilder = exports.ListenBuilder = exports.ExplainBuilder = exports.DropSequenceBuilder = exports.AlterSequenceBuilder = exports.CreateSequenceBuilder = exports.RawQueryBuilder = exports.CountBuilder = exports.DeleteBuilder = exports.UpdateBuilder = exports.InsertBuilder = exports.SelectBuilder = exports.WindowBuilder = exports.CTEBuilder = exports.SavepointBuilder = exports.TransactionBuilder = exports.DefaultPrivilegesBuilder = exports.DropOwnedBuilder = exports.ReassignOwnedBuilder = exports.SetRoleBuilder = exports.DropRoleBuilder = exports.AlterRoleBuilder = exports.CreateRoleBuilder = exports.RevokeBuilder = exports.GrantBuilder = exports.DropSchemaBuilder = exports.CreateSchemaBuilder = exports.RefreshMaterializedViewBuilder = exports.DropViewBuilder = exports.CreateViewBuilder = exports.DropFunctionBuilder = exports.CreateFunctionBuilder = void 0;
|
|
22
|
+
exports.CaseBuilder = exports.Case = exports.ConditionalFunctions = exports.AggregateFunctions = exports.JsonbFunctions = exports.ArrayFunctions = exports.MathFunctions = exports.DateTimeFunctions = void 0;
|
|
23
|
+
var query_builder_1 = require("./core/query-builder.cjs");
|
|
24
|
+
Object.defineProperty(exports, "relq", { enumerable: true, get: function () { return __importDefault(query_builder_1).default; } });
|
|
25
|
+
var query_builder_2 = require("./core/query-builder.cjs");
|
|
26
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return query_builder_2.relq; } });
|
|
27
|
+
var query_builder_3 = require("./core/query-builder.cjs");
|
|
28
|
+
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return query_builder_3.QueryBuilder; } });
|
|
29
|
+
Object.defineProperty(exports, "TypedSelectBuilder", { enumerable: true, get: function () { return query_builder_3.TypedSelectBuilder; } });
|
|
30
|
+
Object.defineProperty(exports, "TypedInsertBuilder", { enumerable: true, get: function () { return query_builder_3.TypedInsertBuilder; } });
|
|
31
|
+
Object.defineProperty(exports, "TypedUpdateBuilder", { enumerable: true, get: function () { return query_builder_3.TypedUpdateBuilder; } });
|
|
32
|
+
Object.defineProperty(exports, "TypedDeleteBuilder", { enumerable: true, get: function () { return query_builder_3.TypedDeleteBuilder; } });
|
|
33
|
+
Object.defineProperty(exports, "TypedCountBuilder", { enumerable: true, get: function () { return query_builder_3.TypedCountBuilder; } });
|
|
34
|
+
Object.defineProperty(exports, "relqFor", { enumerable: true, get: function () { return query_builder_3.relqFor; } });
|
|
35
|
+
var relq_client_1 = require("./core/relq-client.cjs");
|
|
36
|
+
Object.defineProperty(exports, "Relq", { enumerable: true, get: function () { return relq_client_1.Relq; } });
|
|
37
|
+
var relq_client_2 = require("./core/relq-client.cjs");
|
|
38
|
+
Object.defineProperty(exports, "RelqClient", { enumerable: true, get: function () { return __importDefault(relq_client_2).default; } });
|
|
39
|
+
var relq_errors_1 = require("./errors/relq-errors.cjs");
|
|
40
|
+
Object.defineProperty(exports, "RelqError", { enumerable: true, get: function () { return relq_errors_1.RelqError; } });
|
|
41
|
+
Object.defineProperty(exports, "RelqConnectionError", { enumerable: true, get: function () { return relq_errors_1.RelqConnectionError; } });
|
|
42
|
+
Object.defineProperty(exports, "RelqQueryError", { enumerable: true, get: function () { return relq_errors_1.RelqQueryError; } });
|
|
43
|
+
Object.defineProperty(exports, "RelqTransactionError", { enumerable: true, get: function () { return relq_errors_1.RelqTransactionError; } });
|
|
44
|
+
Object.defineProperty(exports, "RelqConfigError", { enumerable: true, get: function () { return relq_errors_1.RelqConfigError; } });
|
|
45
|
+
Object.defineProperty(exports, "RelqTimeoutError", { enumerable: true, get: function () { return relq_errors_1.RelqTimeoutError; } });
|
|
46
|
+
Object.defineProperty(exports, "RelqPoolError", { enumerable: true, get: function () { return relq_errors_1.RelqPoolError; } });
|
|
47
|
+
Object.defineProperty(exports, "RelqEnvironmentError", { enumerable: true, get: function () { return relq_errors_1.RelqEnvironmentError; } });
|
|
48
|
+
Object.defineProperty(exports, "RelqBuilderError", { enumerable: true, get: function () { return relq_errors_1.RelqBuilderError; } });
|
|
49
|
+
Object.defineProperty(exports, "isRelqError", { enumerable: true, get: function () { return relq_errors_1.isRelqError; } });
|
|
50
|
+
Object.defineProperty(exports, "isRelqConnectionError", { enumerable: true, get: function () { return relq_errors_1.isRelqConnectionError; } });
|
|
51
|
+
Object.defineProperty(exports, "isRelqQueryError", { enumerable: true, get: function () { return relq_errors_1.isRelqQueryError; } });
|
|
52
|
+
Object.defineProperty(exports, "isRelqBuilderError", { enumerable: true, get: function () { return relq_errors_1.isRelqBuilderError; } });
|
|
53
|
+
Object.defineProperty(exports, "wrapError", { enumerable: true, get: function () { return relq_errors_1.wrapError; } });
|
|
54
|
+
Object.defineProperty(exports, "parsePostgresError", { enumerable: true, get: function () { return relq_errors_1.parsePostgresError; } });
|
|
55
|
+
Object.defineProperty(exports, "setupErrorHandler", { enumerable: true, get: function () { return relq_errors_1.setupErrorHandler; } });
|
|
56
|
+
var environment_detection_1 = require("./utils/environment-detection.cjs");
|
|
57
|
+
Object.defineProperty(exports, "detectEnvironment", { enumerable: true, get: function () { return environment_detection_1.detectEnvironment; } });
|
|
58
|
+
Object.defineProperty(exports, "isServerless", { enumerable: true, get: function () { return environment_detection_1.isServerless; } });
|
|
59
|
+
Object.defineProperty(exports, "isTraditional", { enumerable: true, get: function () { return environment_detection_1.isTraditional; } });
|
|
60
|
+
Object.defineProperty(exports, "isEdge", { enumerable: true, get: function () { return environment_detection_1.isEdge; } });
|
|
61
|
+
Object.defineProperty(exports, "getEnvironmentDescription", { enumerable: true, get: function () { return environment_detection_1.getEnvironmentDescription; } });
|
|
62
|
+
var pool_defaults_1 = require("./utils/pool-defaults.cjs");
|
|
63
|
+
Object.defineProperty(exports, "getSmartPoolDefaults", { enumerable: true, get: function () { return pool_defaults_1.getSmartPoolDefaults; } });
|
|
64
|
+
Object.defineProperty(exports, "validatePoolConfig", { enumerable: true, get: function () { return pool_defaults_1.validatePoolConfig; } });
|
|
65
|
+
Object.defineProperty(exports, "mergeWithDefaults", { enumerable: true, get: function () { return pool_defaults_1.mergeWithDefaults; } });
|
|
66
|
+
Object.defineProperty(exports, "formatPoolConfig", { enumerable: true, get: function () { return pool_defaults_1.formatPoolConfig; } });
|
|
67
|
+
__exportStar(require("./types.cjs"), exports);
|
|
68
|
+
var indexing_1 = require("./indexing/index.cjs");
|
|
69
|
+
Object.defineProperty(exports, "CreateIndexBuilder", { enumerable: true, get: function () { return indexing_1.CreateIndexBuilder; } });
|
|
70
|
+
Object.defineProperty(exports, "DropIndexBuilder", { enumerable: true, get: function () { return indexing_1.DropIndexBuilder; } });
|
|
71
|
+
Object.defineProperty(exports, "ReindexBuilder", { enumerable: true, get: function () { return indexing_1.ReindexBuilder; } });
|
|
72
|
+
var table_1 = require("./table/index.cjs");
|
|
73
|
+
Object.defineProperty(exports, "CreateTableBuilder", { enumerable: true, get: function () { return table_1.CreateTableBuilder; } });
|
|
74
|
+
Object.defineProperty(exports, "AlterTableBuilder", { enumerable: true, get: function () { return table_1.AlterTableBuilder; } });
|
|
75
|
+
Object.defineProperty(exports, "DropTableBuilder", { enumerable: true, get: function () { return table_1.DropTableBuilder; } });
|
|
76
|
+
Object.defineProperty(exports, "ConstraintBuilder", { enumerable: true, get: function () { return table_1.ConstraintBuilder; } });
|
|
77
|
+
Object.defineProperty(exports, "PartitionBuilder", { enumerable: true, get: function () { return table_1.PartitionBuilder; } });
|
|
78
|
+
Object.defineProperty(exports, "CreatePartitionBuilder", { enumerable: true, get: function () { return table_1.CreatePartitionBuilder; } });
|
|
79
|
+
Object.defineProperty(exports, "AttachPartitionBuilder", { enumerable: true, get: function () { return table_1.AttachPartitionBuilder; } });
|
|
80
|
+
Object.defineProperty(exports, "DetachPartitionBuilder", { enumerable: true, get: function () { return table_1.DetachPartitionBuilder; } });
|
|
81
|
+
Object.defineProperty(exports, "TruncateBuilder", { enumerable: true, get: function () { return table_1.TruncateBuilder; } });
|
|
82
|
+
var trigger_1 = require("./trigger/index.cjs");
|
|
83
|
+
Object.defineProperty(exports, "CreateTriggerBuilder", { enumerable: true, get: function () { return trigger_1.CreateTriggerBuilder; } });
|
|
84
|
+
Object.defineProperty(exports, "DropTriggerBuilder", { enumerable: true, get: function () { return trigger_1.DropTriggerBuilder; } });
|
|
85
|
+
var function_1 = require("./function/index.cjs");
|
|
86
|
+
Object.defineProperty(exports, "CreateFunctionBuilder", { enumerable: true, get: function () { return function_1.CreateFunctionBuilder; } });
|
|
87
|
+
Object.defineProperty(exports, "DropFunctionBuilder", { enumerable: true, get: function () { return function_1.DropFunctionBuilder; } });
|
|
88
|
+
var view_1 = require("./view/index.cjs");
|
|
89
|
+
Object.defineProperty(exports, "CreateViewBuilder", { enumerable: true, get: function () { return view_1.CreateViewBuilder; } });
|
|
90
|
+
Object.defineProperty(exports, "DropViewBuilder", { enumerable: true, get: function () { return view_1.DropViewBuilder; } });
|
|
91
|
+
Object.defineProperty(exports, "RefreshMaterializedViewBuilder", { enumerable: true, get: function () { return view_1.RefreshMaterializedViewBuilder; } });
|
|
92
|
+
var schema_1 = require("./schema/index.cjs");
|
|
93
|
+
Object.defineProperty(exports, "CreateSchemaBuilder", { enumerable: true, get: function () { return schema_1.CreateSchemaBuilder; } });
|
|
94
|
+
Object.defineProperty(exports, "DropSchemaBuilder", { enumerable: true, get: function () { return schema_1.DropSchemaBuilder; } });
|
|
95
|
+
Object.defineProperty(exports, "GrantBuilder", { enumerable: true, get: function () { return schema_1.GrantBuilder; } });
|
|
96
|
+
Object.defineProperty(exports, "RevokeBuilder", { enumerable: true, get: function () { return schema_1.RevokeBuilder; } });
|
|
97
|
+
Object.defineProperty(exports, "CreateRoleBuilder", { enumerable: true, get: function () { return schema_1.CreateRoleBuilder; } });
|
|
98
|
+
Object.defineProperty(exports, "AlterRoleBuilder", { enumerable: true, get: function () { return schema_1.AlterRoleBuilder; } });
|
|
99
|
+
Object.defineProperty(exports, "DropRoleBuilder", { enumerable: true, get: function () { return schema_1.DropRoleBuilder; } });
|
|
100
|
+
Object.defineProperty(exports, "SetRoleBuilder", { enumerable: true, get: function () { return schema_1.SetRoleBuilder; } });
|
|
101
|
+
Object.defineProperty(exports, "ReassignOwnedBuilder", { enumerable: true, get: function () { return schema_1.ReassignOwnedBuilder; } });
|
|
102
|
+
Object.defineProperty(exports, "DropOwnedBuilder", { enumerable: true, get: function () { return schema_1.DropOwnedBuilder; } });
|
|
103
|
+
Object.defineProperty(exports, "DefaultPrivilegesBuilder", { enumerable: true, get: function () { return schema_1.DefaultPrivilegesBuilder; } });
|
|
104
|
+
var transaction_1 = require("./transaction/index.cjs");
|
|
105
|
+
Object.defineProperty(exports, "TransactionBuilder", { enumerable: true, get: function () { return transaction_1.TransactionBuilder; } });
|
|
106
|
+
Object.defineProperty(exports, "SavepointBuilder", { enumerable: true, get: function () { return transaction_1.SavepointBuilder; } });
|
|
107
|
+
var cte_1 = require("./cte/index.cjs");
|
|
108
|
+
Object.defineProperty(exports, "CTEBuilder", { enumerable: true, get: function () { return cte_1.CTEBuilder; } });
|
|
109
|
+
var window_1 = require("./window/index.cjs");
|
|
110
|
+
Object.defineProperty(exports, "WindowBuilder", { enumerable: true, get: function () { return window_1.WindowBuilder; } });
|
|
111
|
+
var select_1 = require("./select/index.cjs");
|
|
112
|
+
Object.defineProperty(exports, "SelectBuilder", { enumerable: true, get: function () { return select_1.SelectBuilder; } });
|
|
113
|
+
var insert_1 = require("./insert/index.cjs");
|
|
114
|
+
Object.defineProperty(exports, "InsertBuilder", { enumerable: true, get: function () { return insert_1.InsertBuilder; } });
|
|
115
|
+
var update_1 = require("./update/index.cjs");
|
|
116
|
+
Object.defineProperty(exports, "UpdateBuilder", { enumerable: true, get: function () { return update_1.UpdateBuilder; } });
|
|
117
|
+
var delete_1 = require("./delete/index.cjs");
|
|
118
|
+
Object.defineProperty(exports, "DeleteBuilder", { enumerable: true, get: function () { return delete_1.DeleteBuilder; } });
|
|
119
|
+
var count_1 = require("./count/index.cjs");
|
|
120
|
+
Object.defineProperty(exports, "CountBuilder", { enumerable: true, get: function () { return count_1.CountBuilder; } });
|
|
121
|
+
var raw_1 = require("./raw/index.cjs");
|
|
122
|
+
Object.defineProperty(exports, "RawQueryBuilder", { enumerable: true, get: function () { return raw_1.RawQueryBuilder; } });
|
|
123
|
+
var sequence_1 = require("./sequence/index.cjs");
|
|
124
|
+
Object.defineProperty(exports, "CreateSequenceBuilder", { enumerable: true, get: function () { return sequence_1.CreateSequenceBuilder; } });
|
|
125
|
+
Object.defineProperty(exports, "AlterSequenceBuilder", { enumerable: true, get: function () { return sequence_1.AlterSequenceBuilder; } });
|
|
126
|
+
Object.defineProperty(exports, "DropSequenceBuilder", { enumerable: true, get: function () { return sequence_1.DropSequenceBuilder; } });
|
|
127
|
+
var explain_1 = require("./explain/index.cjs");
|
|
128
|
+
Object.defineProperty(exports, "ExplainBuilder", { enumerable: true, get: function () { return explain_1.ExplainBuilder; } });
|
|
129
|
+
var pubsub_1 = require("./pubsub/index.cjs");
|
|
130
|
+
Object.defineProperty(exports, "ListenBuilder", { enumerable: true, get: function () { return pubsub_1.ListenBuilder; } });
|
|
131
|
+
Object.defineProperty(exports, "UnlistenBuilder", { enumerable: true, get: function () { return pubsub_1.UnlistenBuilder; } });
|
|
132
|
+
Object.defineProperty(exports, "NotifyBuilder", { enumerable: true, get: function () { return pubsub_1.NotifyBuilder; } });
|
|
133
|
+
var maintenance_1 = require("./maintenance/index.cjs");
|
|
134
|
+
Object.defineProperty(exports, "VacuumBuilder", { enumerable: true, get: function () { return maintenance_1.VacuumBuilder; } });
|
|
135
|
+
Object.defineProperty(exports, "AnalyzeBuilder", { enumerable: true, get: function () { return maintenance_1.AnalyzeBuilder; } });
|
|
136
|
+
var copy_1 = require("./copy/index.cjs");
|
|
137
|
+
Object.defineProperty(exports, "CopyToBuilder", { enumerable: true, get: function () { return copy_1.CopyToBuilder; } });
|
|
138
|
+
Object.defineProperty(exports, "CopyFromBuilder", { enumerable: true, get: function () { return copy_1.CopyFromBuilder; } });
|
|
139
|
+
var cache_1 = require("./cache/index.cjs");
|
|
140
|
+
Object.defineProperty(exports, "QueryCache", { enumerable: true, get: function () { return cache_1.QueryCache; } });
|
|
141
|
+
Object.defineProperty(exports, "CacheKeyBuilder", { enumerable: true, get: function () { return cache_1.CacheKeyBuilder; } });
|
|
142
|
+
Object.defineProperty(exports, "createQueryCacheMiddleware", { enumerable: true, get: function () { return cache_1.createQueryCacheMiddleware; } });
|
|
143
|
+
Object.defineProperty(exports, "withCache", { enumerable: true, get: function () { return cache_1.withCache; } });
|
|
144
|
+
Object.defineProperty(exports, "createTableCache", { enumerable: true, get: function () { return cache_1.createTableCache; } });
|
|
145
|
+
var utils_1 = require("./utils/index.cjs");
|
|
146
|
+
Object.defineProperty(exports, "convertCase", { enumerable: true, get: function () { return utils_1.convertCase; } });
|
|
147
|
+
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return utils_1.format; } });
|
|
148
|
+
var pg_values_1 = require("./constants/pg-values.cjs");
|
|
149
|
+
Object.defineProperty(exports, "PgValue", { enumerable: true, get: function () { return pg_values_1.PgValue; } });
|
|
150
|
+
Object.defineProperty(exports, "PG", { enumerable: true, get: function () { return pg_values_1.PG; } });
|
|
151
|
+
Object.defineProperty(exports, "RawValue", { enumerable: true, get: function () { return pg_values_1.RawValue; } });
|
|
152
|
+
var functions_1 = require("./functions/index.cjs");
|
|
153
|
+
Object.defineProperty(exports, "F", { enumerable: true, get: function () { return functions_1.F; } });
|
|
154
|
+
Object.defineProperty(exports, "SqlFunction", { enumerable: true, get: function () { return functions_1.SqlFunction; } });
|
|
155
|
+
Object.defineProperty(exports, "StringFunctions", { enumerable: true, get: function () { return functions_1.StringFunctions; } });
|
|
156
|
+
Object.defineProperty(exports, "DateTimeFunctions", { enumerable: true, get: function () { return functions_1.DateTimeFunctions; } });
|
|
157
|
+
Object.defineProperty(exports, "MathFunctions", { enumerable: true, get: function () { return functions_1.MathFunctions; } });
|
|
158
|
+
Object.defineProperty(exports, "ArrayFunctions", { enumerable: true, get: function () { return functions_1.ArrayFunctions; } });
|
|
159
|
+
Object.defineProperty(exports, "JsonbFunctions", { enumerable: true, get: function () { return functions_1.JsonbFunctions; } });
|
|
160
|
+
Object.defineProperty(exports, "AggregateFunctions", { enumerable: true, get: function () { return functions_1.AggregateFunctions; } });
|
|
161
|
+
Object.defineProperty(exports, "ConditionalFunctions", { enumerable: true, get: function () { return functions_1.ConditionalFunctions; } });
|
|
162
|
+
var case_builder_1 = require("./functions/case-builder.cjs");
|
|
163
|
+
Object.defineProperty(exports, "Case", { enumerable: true, get: function () { return case_builder_1.Case; } });
|
|
164
|
+
Object.defineProperty(exports, "CaseBuilder", { enumerable: true, get: function () { return case_builder_1.CaseBuilder; } });
|