rado 0.3.3 → 0.3.4

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.
Files changed (87) hide show
  1. package/README.md +277 -277
  2. package/dist/define/CTE.d.ts +2 -0
  3. package/dist/define/CTE.js +51 -0
  4. package/dist/define/Cursor.d.ts +108 -0
  5. package/dist/define/Cursor.js +338 -0
  6. package/dist/define/Table.d.ts +5 -1
  7. package/dist/define/Table.js +5 -0
  8. package/dist/define/Update.d.ts +4 -0
  9. package/dist/define/Update.js +0 -0
  10. package/dist/define/query/Batch.d.ts +7 -0
  11. package/dist/define/query/Batch.js +17 -0
  12. package/dist/define/query/CreateTable.d.ts +6 -0
  13. package/dist/define/query/CreateTable.js +11 -0
  14. package/dist/define/query/Delete.d.ts +11 -0
  15. package/dist/define/query/Delete.js +18 -0
  16. package/dist/define/query/Insert.d.ts +22 -0
  17. package/dist/define/query/Insert.js +47 -0
  18. package/dist/define/query/Select.d.ts +39 -0
  19. package/dist/define/query/Select.js +170 -0
  20. package/dist/define/query/TableSelect.d.ts +28 -0
  21. package/dist/define/query/TableSelect.js +79 -0
  22. package/dist/define/query/Union.d.ts +17 -0
  23. package/dist/define/query/Union.js +116 -0
  24. package/dist/define/query/Update.d.ts +12 -0
  25. package/dist/define/query/Update.js +18 -0
  26. package/dist/deno/driver/better-sqlite3.js +57 -0
  27. package/dist/deno/driver/bun-sqlite.js +69 -0
  28. package/dist/deno/driver/sql.js.js +72 -0
  29. package/dist/deno/driver/sqlite3.js +123 -0
  30. package/dist/deno/index.js +14 -0
  31. package/dist/deno/lib/Driver.js +330 -0
  32. package/dist/deno/lib/Formatter.js +715 -0
  33. package/dist/deno/lib/Sanitizer.js +0 -0
  34. package/dist/deno/lib/SqlError.js +11 -0
  35. package/dist/deno/lib/Statement.js +108 -0
  36. package/dist/deno/sqlite/SqliteFormatter.js +70 -0
  37. package/dist/deno/sqlite/SqliteFunctions.js +150 -0
  38. package/dist/deno/sqlite/SqliteSchema.js +47 -0
  39. package/dist/deno/sqlite.js +3 -0
  40. package/dist/deno/util/Callable.js +15 -0
  41. package/dist/lib/Formatter.js +17 -3
  42. package/dist/sqlite/index.d.ts +2 -0
  43. package/dist/sqlite/index.js +3 -0
  44. package/dist/src/driver/better-sqlite3.js +49 -0
  45. package/dist/src/driver/sql.js.js +66 -0
  46. package/dist/src/driver/sqlite3.js +87 -0
  47. package/dist/src/index.js +24 -0
  48. package/dist/src/lib/Column.js +63 -0
  49. package/dist/src/lib/Cursor.js +231 -0
  50. package/dist/src/lib/Driver.js +316 -0
  51. package/dist/src/lib/Expr.js +284 -0
  52. package/dist/src/lib/Fields.js +0 -0
  53. package/dist/src/lib/Formatter.js +625 -0
  54. package/dist/src/lib/Functions.js +11 -0
  55. package/dist/src/lib/Id.js +0 -0
  56. package/dist/src/lib/Index.js +20 -0
  57. package/dist/src/lib/Ops.js +45 -0
  58. package/dist/src/lib/OrderBy.js +9 -0
  59. package/dist/src/lib/Param.js +27 -0
  60. package/dist/src/lib/Query.js +74 -0
  61. package/dist/src/lib/Sanitizer.js +0 -0
  62. package/dist/src/lib/Schema.js +67 -0
  63. package/dist/src/lib/Selection.js +7 -0
  64. package/dist/src/lib/Statement.js +103 -0
  65. package/dist/src/lib/Table.js +130 -0
  66. package/dist/src/lib/Target.js +37 -0
  67. package/dist/src/lib/Update.js +0 -0
  68. package/dist/src/sqlite/SqliteFormatter.js +67 -0
  69. package/dist/src/sqlite/SqliteFunctions.js +146 -0
  70. package/dist/src/sqlite/SqliteSchema.js +47 -0
  71. package/dist/src/sqlite.js +3 -0
  72. package/dist/test/DbSuite.js +28 -0
  73. package/dist/test/TSTestTypes.js +6 -0
  74. package/dist/test/TestBasic.js +172 -0
  75. package/dist/test/TestExtend.js +68 -0
  76. package/dist/test/TestFts5.js +34 -0
  77. package/dist/test/TestFunctions.js +28 -0
  78. package/dist/test/TestJoins.js +34 -0
  79. package/dist/test/TestJson.js +33 -0
  80. package/dist/test/TestPrepare.js +27 -0
  81. package/dist/test/TestRawSql.js +31 -0
  82. package/dist/test/TestSchema.js +69 -0
  83. package/dist/test/TestSubQueries.js +79 -0
  84. package/dist/test/TestTransaction.js +54 -0
  85. package/dist/test/TestUpdate.js +95 -0
  86. package/dist/test/index.js +14 -0
  87. package/package.json +74 -74
@@ -0,0 +1,9 @@
1
+ // src/lib/OrderBy.ts
2
+ var OrderDirection = /* @__PURE__ */ ((OrderDirection2) => {
3
+ OrderDirection2["Asc"] = "Asc";
4
+ OrderDirection2["Desc"] = "Desc";
5
+ return OrderDirection2;
6
+ })(OrderDirection || {});
7
+ export {
8
+ OrderDirection
9
+ };
@@ -0,0 +1,27 @@
1
+ // src/lib/Param.ts
2
+ import { Expr, ExprData } from "./Expr.js";
3
+ var ParamType = /* @__PURE__ */ ((ParamType2) => {
4
+ ParamType2["Value"] = "Value";
5
+ ParamType2["Named"] = "Named";
6
+ return ParamType2;
7
+ })(ParamType || {});
8
+ var ParamData = {
9
+ Value(value) {
10
+ return { type: "Value" /* Value */, value };
11
+ },
12
+ Named(name) {
13
+ return { type: "Named" /* Named */, name };
14
+ }
15
+ };
16
+ function createParams() {
17
+ return new Proxy({}, {
18
+ get(target, prop) {
19
+ return new Expr(ExprData.Param(ParamData.Named(prop)));
20
+ }
21
+ });
22
+ }
23
+ export {
24
+ ParamData,
25
+ ParamType,
26
+ createParams
27
+ };
@@ -0,0 +1,74 @@
1
+ // src/lib/Query.ts
2
+ var QueryType = /* @__PURE__ */ ((QueryType2) => {
3
+ QueryType2["Insert"] = "Insert";
4
+ QueryType2["Select"] = "Select";
5
+ QueryType2["Update"] = "Update";
6
+ QueryType2["Delete"] = "Delete";
7
+ QueryType2["CreateTable"] = "CreateTable";
8
+ QueryType2["CreateIndex"] = "CreateIndex";
9
+ QueryType2["DropIndex"] = "DropIndex";
10
+ QueryType2["AlterTable"] = "AlterTable";
11
+ QueryType2["Batch"] = "Batch";
12
+ QueryType2["Transaction"] = "Transaction";
13
+ QueryType2["Raw"] = "Raw";
14
+ return QueryType2;
15
+ })(QueryType || {});
16
+ var Query;
17
+ ((Query2) => {
18
+ function Insert(insert) {
19
+ return { type: "Insert" /* Insert */, ...insert };
20
+ }
21
+ Query2.Insert = Insert;
22
+ function Select(select) {
23
+ return { type: "Select" /* Select */, ...select };
24
+ }
25
+ Query2.Select = Select;
26
+ function Update(update) {
27
+ return { type: "Update" /* Update */, ...update };
28
+ }
29
+ Query2.Update = Update;
30
+ function Delete(del) {
31
+ return { type: "Delete" /* Delete */, ...del };
32
+ }
33
+ Query2.Delete = Delete;
34
+ function CreateTable(create) {
35
+ return { type: "CreateTable" /* CreateTable */, ...create };
36
+ }
37
+ Query2.CreateTable = CreateTable;
38
+ function CreateIndex(create) {
39
+ return { type: "CreateIndex" /* CreateIndex */, ...create };
40
+ }
41
+ Query2.CreateIndex = CreateIndex;
42
+ function DropIndex(drop) {
43
+ return { type: "DropIndex" /* DropIndex */, ...drop };
44
+ }
45
+ Query2.DropIndex = DropIndex;
46
+ function Batch(batch) {
47
+ return { type: "Batch" /* Batch */, ...batch };
48
+ }
49
+ Query2.Batch = Batch;
50
+ let TransactionOperation;
51
+ ((TransactionOperation2) => {
52
+ TransactionOperation2["Begin"] = "Begin";
53
+ TransactionOperation2["Commit"] = "Commit";
54
+ TransactionOperation2["Rollback"] = "Rollback";
55
+ })(TransactionOperation = Query2.TransactionOperation || (Query2.TransactionOperation = {}));
56
+ function Transaction(transaction) {
57
+ return { type: "Transaction" /* Transaction */, ...transaction };
58
+ }
59
+ Query2.Transaction = Transaction;
60
+ function Raw(raw) {
61
+ if (raw.strings.some((chunk) => chunk.includes("?")))
62
+ throw new TypeError("SQL injection hazard");
63
+ return { type: "Raw" /* Raw */, ...raw };
64
+ }
65
+ Query2.Raw = Raw;
66
+ function AlterTable(alter) {
67
+ return { type: "AlterTable" /* AlterTable */, ...alter };
68
+ }
69
+ Query2.AlterTable = AlterTable;
70
+ })(Query || (Query = {}));
71
+ export {
72
+ Query,
73
+ QueryType
74
+ };
File without changes
@@ -0,0 +1,67 @@
1
+ // src/lib/Schema.ts
2
+ import { Query } from "./Query.js";
3
+ import { Statement } from "./Statement.js";
4
+ var Schema;
5
+ ((Schema2) => {
6
+ function create(schema) {
7
+ const queries = [];
8
+ queries.push(Query.CreateTable({ table: schema, ifNotExists: true }));
9
+ for (const index of Object.values(schema.indexes))
10
+ queries.push(Query.CreateIndex({ table: schema, index, ifNotExists: true }));
11
+ return Query.Batch({ queries });
12
+ }
13
+ Schema2.create = create;
14
+ function removeLeadingWhitespace(str) {
15
+ return str.replace(/\n\s+/g, "\n");
16
+ }
17
+ function upgrade(formatter, local, schema) {
18
+ const columnNames = /* @__PURE__ */ new Set([
19
+ ...Object.keys(local.columns),
20
+ ...Object.keys(schema.columns)
21
+ ]);
22
+ const res = [];
23
+ for (const columnName of columnNames) {
24
+ const localInstruction = local.columns[columnName];
25
+ const schemaCol = schema.columns[columnName];
26
+ if (!localInstruction) {
27
+ res.push(Query.AlterTable({ table: schema, addColumn: schemaCol }));
28
+ } else if (!schemaCol) {
29
+ res.push(Query.AlterTable({ table: schema, dropColumn: columnName }));
30
+ } else {
31
+ const { sql: instruction } = formatter.formatColumn(
32
+ { stmt: new Statement(formatter) },
33
+ { ...schemaCol, references: void 0 }
34
+ );
35
+ if (removeLeadingWhitespace(localInstruction) !== removeLeadingWhitespace(instruction)) {
36
+ res.push(Query.AlterTable({ table: schema, alterColumn: schemaCol }));
37
+ }
38
+ }
39
+ }
40
+ const indexNames = /* @__PURE__ */ new Set([
41
+ ...Object.keys(local.indexes),
42
+ ...Object.keys(schema.indexes)
43
+ ]);
44
+ for (const indexName of indexNames) {
45
+ const localInstruction = local.indexes[indexName];
46
+ const schemaIndex = schema.indexes[indexName];
47
+ if (!localInstruction) {
48
+ res.push(Query.CreateIndex({ table: schema, index: schemaIndex }));
49
+ } else if (!schemaIndex) {
50
+ res.unshift(Query.DropIndex({ table: schema, name: indexName }));
51
+ } else {
52
+ const { sql: instruction } = formatter.compile(
53
+ Query.CreateIndex({ table: schema, index: schemaIndex })
54
+ );
55
+ if (removeLeadingWhitespace(localInstruction) !== removeLeadingWhitespace(instruction)) {
56
+ res.unshift(Query.DropIndex({ table: schema, name: indexName }));
57
+ res.push(Query.CreateIndex({ table: schema, index: schemaIndex }));
58
+ }
59
+ }
60
+ }
61
+ return res;
62
+ }
63
+ Schema2.upgrade = upgrade;
64
+ })(Schema || (Schema = {}));
65
+ export {
66
+ Schema
67
+ };
@@ -0,0 +1,7 @@
1
+ // src/lib/Selection.ts
2
+ var Selection;
3
+ ((Selection2) => {
4
+ })(Selection || (Selection = {}));
5
+ export {
6
+ Selection
7
+ };
@@ -0,0 +1,103 @@
1
+ // src/lib/Statement.ts
2
+ import { ParamData, ParamType } from "./Param.js";
3
+ var SEPARATE = ", ";
4
+ var WHITESPACE = " ";
5
+ var NEWLINE = "\n";
6
+ var INSERT_PARAM = "?";
7
+ var Statement = class {
8
+ constructor(sanitizer, sql = "", paramData = []) {
9
+ this.sanitizer = sanitizer;
10
+ this.sql = sql;
11
+ this.paramData = paramData;
12
+ }
13
+ currentIndent = "";
14
+ space() {
15
+ if (this.sql === "")
16
+ return this;
17
+ return this.raw(WHITESPACE);
18
+ }
19
+ add(addition) {
20
+ if (!addition)
21
+ return this;
22
+ return this.space().raw(addition);
23
+ }
24
+ addLine(addition) {
25
+ if (!addition)
26
+ return this;
27
+ return this.newline().add(addition);
28
+ }
29
+ indent() {
30
+ this.currentIndent = this.currentIndent + " ";
31
+ return this;
32
+ }
33
+ dedent() {
34
+ this.currentIndent = this.currentIndent.slice(0, -2);
35
+ return this;
36
+ }
37
+ newline() {
38
+ return this.raw(NEWLINE + this.currentIndent);
39
+ }
40
+ identifier(name) {
41
+ return this.raw(this.sanitizer.escapeIdentifier(name));
42
+ }
43
+ addIdentifier(name) {
44
+ return this.space().identifier(name);
45
+ }
46
+ value(value) {
47
+ this.paramData.push(ParamData.Value(value));
48
+ return this.raw(INSERT_PARAM);
49
+ }
50
+ addValue(value) {
51
+ return this.space().value(value);
52
+ }
53
+ param(name) {
54
+ this.paramData.push(ParamData.Named(name));
55
+ return this.raw(INSERT_PARAM);
56
+ }
57
+ addParam(name) {
58
+ return this.space().param(name);
59
+ }
60
+ raw(query) {
61
+ if (!query)
62
+ return this;
63
+ this.sql += query;
64
+ return this;
65
+ }
66
+ openParenthesis() {
67
+ return this.raw("(").indent().newline();
68
+ }
69
+ closeParenthesis() {
70
+ return this.dedent().newline().raw(")");
71
+ }
72
+ *call(parts, separator = SEPARATE) {
73
+ this.openParenthesis();
74
+ yield* this.separate(parts, separator);
75
+ this.closeParenthesis();
76
+ }
77
+ *separate(parts, separator = SEPARATE) {
78
+ for (let i = 0; i < parts.length; i++) {
79
+ if (i > 0)
80
+ this.raw(separator).newline();
81
+ yield parts[i];
82
+ }
83
+ }
84
+ isEmpty() {
85
+ return this.sql === "";
86
+ }
87
+ params(input) {
88
+ return this.paramData.map((param) => {
89
+ if (param.type === ParamType.Named) {
90
+ if (input && param.name in input)
91
+ return this.sanitizer.formatParamValue(input[param.name]);
92
+ throw new TypeError(`Missing parameter ${param.name}`);
93
+ }
94
+ return this.sanitizer.formatParamValue(param.value);
95
+ });
96
+ }
97
+ toString() {
98
+ return this.sql;
99
+ }
100
+ };
101
+ export {
102
+ Statement
103
+ };
@@ -0,0 +1,130 @@
1
+ // src/lib/Table.ts
2
+ import { Cursor } from "./Cursor.js";
3
+ import { Expr, ExprData } from "./Expr.js";
4
+ import { Query } from "./Query.js";
5
+ import { Selection } from "./Selection.js";
6
+ import { Target } from "./Target.js";
7
+ var Table = class extends Cursor.SelectMultiple {
8
+ [Selection.__tableType]() {
9
+ throw "assert";
10
+ }
11
+ constructor(schema) {
12
+ super(
13
+ Query.Select({
14
+ from: Target.Table(schema),
15
+ selection: ExprData.Row(Target.Table(schema))
16
+ })
17
+ );
18
+ Object.defineProperty(this, "schema", {
19
+ enumerable: false,
20
+ value: () => schema
21
+ });
22
+ if (schema.columns)
23
+ for (const column of Object.keys(schema.columns)) {
24
+ Object.defineProperty(this, column, {
25
+ enumerable: true,
26
+ get: () => this.get(column)
27
+ });
28
+ }
29
+ return new Proxy(this, {
30
+ get(target, key) {
31
+ return key in target ? target[key] : target.get(key);
32
+ }
33
+ });
34
+ }
35
+ fetch(id) {
36
+ return this.where(this.get("id").is(id)).first();
37
+ }
38
+ insertOne(record) {
39
+ return new Cursor(
40
+ Query.Insert({
41
+ into: this.schema(),
42
+ data: [record],
43
+ selection: ExprData.Row(Target.Table(this.schema())),
44
+ singleResult: true
45
+ })
46
+ );
47
+ }
48
+ insertAll(data) {
49
+ return new Cursor.Insert(this.schema()).values(...data);
50
+ }
51
+ set(data) {
52
+ return new Cursor.Update(
53
+ Query.Update({
54
+ table: this.schema()
55
+ })
56
+ ).set(data);
57
+ }
58
+ delete() {
59
+ return new Cursor.Delete(Query.Delete({ table: this.schema() }));
60
+ }
61
+ createTable() {
62
+ return new Cursor.Create(this.schema());
63
+ }
64
+ as(alias) {
65
+ return new Table({ ...this.schema(), alias });
66
+ }
67
+ alias() {
68
+ return new Proxy(
69
+ {},
70
+ {
71
+ get: (_, key) => {
72
+ return this.as(key);
73
+ }
74
+ }
75
+ );
76
+ }
77
+ get(name) {
78
+ return new Expr(ExprData.Field(this.toExpr().expr, name));
79
+ }
80
+ toExpr() {
81
+ return new Expr(
82
+ ExprData.Row(Target.Table(this.schema()))
83
+ );
84
+ }
85
+ schema() {
86
+ throw new Error("Not implemented");
87
+ }
88
+ };
89
+ function table(options) {
90
+ const schema = {
91
+ ...options,
92
+ columns: Object.fromEntries(
93
+ Object.entries(options.columns).map(([key, column]) => {
94
+ const { data } = column;
95
+ return [key, { ...data, name: data.name || key }];
96
+ })
97
+ ),
98
+ indexes: {}
99
+ };
100
+ const indexes = Object.fromEntries(
101
+ Object.entries(
102
+ options.indexes ? options.indexes.call(
103
+ new Expr(ExprData.Row(Target.Table(schema)))
104
+ ) : {}
105
+ ).map(([key, index]) => {
106
+ const indexName = `${schema.name}.${key}`;
107
+ return [indexName, { name: indexName, ...index.data }];
108
+ })
109
+ );
110
+ return new Table({
111
+ ...schema,
112
+ indexes
113
+ });
114
+ }
115
+ ((table2) => {
116
+ function extend(target, extensions) {
117
+ return new Proxy(target, {
118
+ get(target2, key) {
119
+ if (key === "as")
120
+ return (...args) => extend(target2.as(...args), extensions);
121
+ return key in extensions ? extensions[key].bind(target2) : target2[key];
122
+ }
123
+ });
124
+ }
125
+ table2.extend = extend;
126
+ })(table || (table = {}));
127
+ export {
128
+ Table,
129
+ table
130
+ };
@@ -0,0 +1,37 @@
1
+ // src/lib/Target.ts
2
+ var TargetType = /* @__PURE__ */ ((TargetType2) => {
3
+ TargetType2["Each"] = "Each";
4
+ TargetType2["Table"] = "Table";
5
+ TargetType2["Join"] = "Join";
6
+ return TargetType2;
7
+ })(TargetType || {});
8
+ var Target;
9
+ ((Target2) => {
10
+ function Each(expr, alias) {
11
+ return { type: "Each" /* Each */, expr, alias };
12
+ }
13
+ Target2.Each = Each;
14
+ function Table(table) {
15
+ return { type: "Table" /* Table */, table };
16
+ }
17
+ Target2.Table = Table;
18
+ function Join(left, right, joinType, on) {
19
+ return { type: "Join" /* Join */, left, right, joinType, on };
20
+ }
21
+ Target2.Join = Join;
22
+ function source(from) {
23
+ switch (from.type) {
24
+ case "Table" /* Table */:
25
+ return from.table;
26
+ case "Join" /* Join */:
27
+ return source(from.left);
28
+ default:
29
+ return void 0;
30
+ }
31
+ }
32
+ Target2.source = source;
33
+ })(Target || (Target = {}));
34
+ export {
35
+ Target,
36
+ TargetType
37
+ };
File without changes
@@ -0,0 +1,67 @@
1
+ // src/sqlite/SqliteFormatter.ts
2
+ import { ExprType } from "../lib/Expr.js";
3
+ import { Formatter } from "../lib/Formatter.js";
4
+ import { TargetType } from "../lib/Target.js";
5
+ var BACKTICK = "`";
6
+ var ESCAPE_BACKTICK = "``";
7
+ var SINGLE_QUOTE = "'";
8
+ var ESCAPE_SINGLE_QUOTE = "''";
9
+ var MATCH_BACKTICK = /`/g;
10
+ var MATCH_SINGLE_QUOTE = /'/g;
11
+ var SqliteFormatter = class extends Formatter {
12
+ formatParamValue(paramValue) {
13
+ if (paramValue === null || paramValue === void 0)
14
+ return null;
15
+ if (typeof paramValue === "boolean")
16
+ return paramValue ? 1 : 0;
17
+ if (typeof paramValue === "number")
18
+ return paramValue;
19
+ if (typeof paramValue === "string")
20
+ return paramValue;
21
+ return JSON.stringify(paramValue);
22
+ }
23
+ escapeValue(value) {
24
+ if (value === null || value === void 0)
25
+ return "NULL";
26
+ if (typeof value === "boolean")
27
+ return value ? "1" : "0";
28
+ if (typeof value === "number")
29
+ return String(value);
30
+ if (typeof value === "string")
31
+ return this.escapeString(value);
32
+ return "json(" + this.escapeString(JSON.stringify(value)) + ")";
33
+ }
34
+ escapeIdentifier(input) {
35
+ return BACKTICK + input.replace(MATCH_BACKTICK, ESCAPE_BACKTICK) + BACKTICK;
36
+ }
37
+ escapeString(input) {
38
+ return SINGLE_QUOTE + input.replace(MATCH_SINGLE_QUOTE, ESCAPE_SINGLE_QUOTE) + SINGLE_QUOTE;
39
+ }
40
+ formatAccess(ctx, mkSubject, field) {
41
+ const { stmt, formatAsJson } = ctx;
42
+ mkSubject();
43
+ stmt.raw(formatAsJson ? "->" : "->>");
44
+ return this.formatString(ctx, `$.${field}`);
45
+ }
46
+ formatExpr(ctx, expr) {
47
+ const { stmt } = ctx;
48
+ switch (expr.type) {
49
+ case ExprType.Call:
50
+ if (expr.method === "match") {
51
+ const [from, query] = expr.params;
52
+ if (from.type !== ExprType.Row)
53
+ throw new Error("not implemented");
54
+ if (from.target.type !== TargetType.Table)
55
+ throw new Error("not implemented");
56
+ stmt.identifier(from.target.table.alias || from.target.table.name).raw(" MATCH ");
57
+ this.formatExprValue(ctx, query);
58
+ return stmt;
59
+ }
60
+ default:
61
+ return super.formatExpr(ctx, expr);
62
+ }
63
+ }
64
+ };
65
+ export {
66
+ SqliteFormatter
67
+ };
@@ -0,0 +1,146 @@
1
+ // src/sqlite/SqliteFunctions.ts
2
+ import { Functions } from "../lib/Functions.js";
3
+ var SqliteFunctions = Functions;
4
+ var {
5
+ count,
6
+ iif,
7
+ exists,
8
+ match,
9
+ cast,
10
+ abs,
11
+ changes,
12
+ char,
13
+ coalesce,
14
+ ifnull,
15
+ instr,
16
+ last_insert_rowid,
17
+ length,
18
+ likelihood,
19
+ likely,
20
+ lower,
21
+ ltrim,
22
+ max,
23
+ min,
24
+ nullif,
25
+ prnumberf,
26
+ quote,
27
+ random,
28
+ replace,
29
+ round,
30
+ rtrim,
31
+ sign,
32
+ soundex,
33
+ sqlite_version,
34
+ substr,
35
+ total_changes,
36
+ trim,
37
+ unicode,
38
+ unlikely,
39
+ upper,
40
+ avg,
41
+ group_concat,
42
+ sum,
43
+ acos,
44
+ acosh,
45
+ asin,
46
+ asinh,
47
+ atan,
48
+ atan2,
49
+ atanh,
50
+ ceil,
51
+ cos,
52
+ cosh,
53
+ degrees,
54
+ exp,
55
+ floor,
56
+ ln,
57
+ log,
58
+ log2,
59
+ mod,
60
+ pi,
61
+ pow,
62
+ radians,
63
+ sin,
64
+ sinh,
65
+ sqrt,
66
+ tan,
67
+ tanh,
68
+ trunc,
69
+ date,
70
+ time,
71
+ datetime,
72
+ julianday,
73
+ strftime
74
+ } = SqliteFunctions;
75
+ export {
76
+ SqliteFunctions,
77
+ abs,
78
+ acos,
79
+ acosh,
80
+ asin,
81
+ asinh,
82
+ atan,
83
+ atan2,
84
+ atanh,
85
+ avg,
86
+ cast,
87
+ ceil,
88
+ changes,
89
+ char,
90
+ coalesce,
91
+ cos,
92
+ cosh,
93
+ count,
94
+ date,
95
+ datetime,
96
+ degrees,
97
+ exists,
98
+ exp,
99
+ floor,
100
+ group_concat,
101
+ ifnull,
102
+ iif,
103
+ instr,
104
+ julianday,
105
+ last_insert_rowid,
106
+ length,
107
+ likelihood,
108
+ likely,
109
+ ln,
110
+ log,
111
+ log2,
112
+ lower,
113
+ ltrim,
114
+ match,
115
+ max,
116
+ min,
117
+ mod,
118
+ nullif,
119
+ pi,
120
+ pow,
121
+ prnumberf,
122
+ quote,
123
+ radians,
124
+ random,
125
+ replace,
126
+ round,
127
+ rtrim,
128
+ sign,
129
+ sin,
130
+ sinh,
131
+ soundex,
132
+ sqlite_version,
133
+ sqrt,
134
+ strftime,
135
+ substr,
136
+ sum,
137
+ tan,
138
+ tanh,
139
+ time,
140
+ total_changes,
141
+ trim,
142
+ trunc,
143
+ unicode,
144
+ unlikely,
145
+ upper
146
+ };