rado 0.1.30 → 0.1.32
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/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/lib/Formatter.js +3 -0
- package/dist/lib/Functions.d.ts +2 -4
- package/dist/lib/Table.d.ts +3 -0
- package/dist/lib/Table.js +3 -0
- package/dist/sqlite/SqliteFunctions.d.ts +11 -6
- package/dist/sqlite/SqliteFunctions.js +4 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './lib/Driver';
|
|
|
4
4
|
export * from './lib/Expr';
|
|
5
5
|
export * from './lib/Fields';
|
|
6
6
|
export * from './lib/Formatter';
|
|
7
|
-
export
|
|
7
|
+
export { Functions } from './lib/Functions';
|
|
8
8
|
export * from './lib/Id';
|
|
9
9
|
export * from './lib/Index';
|
|
10
10
|
export * from './lib/Ops';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export * from "./lib/Driver.js";
|
|
|
5
5
|
export * from "./lib/Expr.js";
|
|
6
6
|
export * from "./lib/Fields.js";
|
|
7
7
|
export * from "./lib/Formatter.js";
|
|
8
|
-
|
|
8
|
+
import { Functions } from "./lib/Functions.js";
|
|
9
9
|
export * from "./lib/Id.js";
|
|
10
10
|
export * from "./lib/Index.js";
|
|
11
11
|
export * from "./lib/Ops.js";
|
|
@@ -19,3 +19,6 @@ export * from "./lib/Statement.js";
|
|
|
19
19
|
export * from "./lib/Table.js";
|
|
20
20
|
export * from "./lib/Target.js";
|
|
21
21
|
export * from "./lib/Update.js";
|
|
22
|
+
export {
|
|
23
|
+
Functions
|
|
24
|
+
};
|
package/dist/lib/Formatter.js
CHANGED
|
@@ -537,6 +537,9 @@ var Formatter = class {
|
|
|
537
537
|
this.formatExprValue(ctx, e).add("as").space();
|
|
538
538
|
this.formatString(ctx, typeName);
|
|
539
539
|
return stmt.closeParenthesis();
|
|
540
|
+
} else if (expr.method === "exists") {
|
|
541
|
+
stmt.raw("exists").space();
|
|
542
|
+
return this.formatExprValue(ctx, expr.params[0]);
|
|
540
543
|
} else {
|
|
541
544
|
stmt.addIdentifier(expr.method).openParenthesis();
|
|
542
545
|
for (const param of stmt.separate(expr.params))
|
package/dist/lib/Functions.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expr } from './Expr';
|
|
2
2
|
export declare const Functions: Functions;
|
|
3
|
-
/** These will have to be supported in every driver */
|
|
4
3
|
export type Functions = {
|
|
5
|
-
|
|
6
|
-
iif<T>(x: EV<boolean>, y: EV<T>, z: EV<T>): Expr<T>;
|
|
4
|
+
[key: string]: (...args: Array<any>) => Expr<any>;
|
|
7
5
|
};
|
package/dist/lib/Table.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ import { Update } from './Update';
|
|
|
9
9
|
export declare class Table<T> extends Cursor.SelectMultiple<Table.Normalize<T>> {
|
|
10
10
|
[Selection.__tableType](): Table.Normalize<T>;
|
|
11
11
|
constructor(schema: Schema);
|
|
12
|
+
fetch(id: EV<T extends {
|
|
13
|
+
id: Column.IsPrimary<infer V, any>;
|
|
14
|
+
} ? V : never>): Cursor.SelectSingle<Table.Normalize<T> | undefined>;
|
|
12
15
|
insertOne(record: Table.Insert<T>): Cursor<Table.Normalize<T>>;
|
|
13
16
|
insertAll(data: Array<Table.Insert<T>>): Cursor.InsertValues;
|
|
14
17
|
set(data: Update<Table.Normalize<T>>): Cursor.Update<Table.Normalize<T>>;
|
package/dist/lib/Table.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
import { Cursor } from '../lib/Cursor';
|
|
1
2
|
import { EV, Expr } from '../lib/Expr';
|
|
2
3
|
import { Table } from '../lib/Table';
|
|
3
4
|
export declare const SqliteFunctions: SqliteFunctions;
|
|
4
5
|
export type SqliteFunctions = {
|
|
6
|
+
/** The count(X) function returns a count of the number of times that X is not NULL in a group. The count(*) function (with no arguments) returns the total number of rows in the group. */
|
|
7
|
+
count(x?: Expr<any>): Expr<number>;
|
|
8
|
+
/** The iif(X,Y,Z) function returns the value Y if X is true, and Z otherwise. The iif(X,Y,Z) function is logically equivalent to and generates the same bytecode as the CASE Expr "CASE WHEN X THEN Y ELSE Z END".*/
|
|
9
|
+
iif<T>(x: EV<boolean>, y: EV<T>, z: EV<T>): Expr<T>;
|
|
10
|
+
/**
|
|
11
|
+
* The EXISTS operator always evaluates to one of the integer values 0 and 1. If executing the SELECT statement specified as the right-hand operand of the EXISTS operator would return one or more rows, then the EXISTS operator evaluates to 1. If executing the SELECT would return no rows at all, then the EXISTS operator evaluates to 0.
|
|
12
|
+
*/
|
|
13
|
+
exists(cursor: Cursor<any>): Expr<boolean>;
|
|
5
14
|
/** Use the match operator for the FTS5 module */
|
|
6
15
|
match(table: Table<any>, searchTerm: EV<string>): Expr<boolean>;
|
|
7
16
|
cast(x: EV<any>, type: 'text'): Expr<string>;
|
|
@@ -19,8 +28,6 @@ export type SqliteFunctions = {
|
|
|
19
28
|
/** The hex() function numbererprets its argument as a BLOB and returns a string which is the upper-case hexadecimal rendering of the content of that blob. If the argument X in "hex(X)" is an numbereger or numbering ponumber number, then "numbererprets its argument as a BLOB" means that the binary number is first converted numbero a UTF8 text representation, then that text is numbererpreted as a BLOB. Hence, "hex(12345678)" renders as "3132333435363738" not the binary representation of the numbereger value "0000000000BC614E".*/
|
|
20
29
|
/** The ifnull() function returns a copy of its first non-NULL argument, or NULL if both arguments are NULL. Ifnull() must have exactly 2 arguments. The ifnull() function is equivalent to coalesce() with two arguments.*/
|
|
21
30
|
ifnull<T>(x: EV<T>, y: EV<T>): Expr<T>;
|
|
22
|
-
/** The iif(X,Y,Z) function returns the value Y if X is true, and Z otherwise. The iif(X,Y,Z) function is logically equivalent to and generates the same bytecode as the CASE Expr "CASE WHEN X THEN Y ELSE Z END".*/
|
|
23
|
-
iif<T>(x: EV<boolean>, y: EV<T>, z: EV<T>): Expr<T>;
|
|
24
31
|
/** The instr(X,Y) function finds the first occurrence of string Y within string X and returns the number of prior characters plus 1, or 0 if Y is nowhere found within X. Or, if X and Y are both BLOBs, then instr(X,Y) returns one more than the number bytes prior to the first occurrence of Y, or 0 if Y does not occur anywhere within X. If both arguments X and Y to instr(X,Y) are non-NULL and are not BLOBs then both are numbererpreted as strings. If either X or Y are NULL in instr(X,Y) then the result is NULL.*/
|
|
25
32
|
instr(x: EV<string>, y: EV<string>): Expr<number>;
|
|
26
33
|
/** The last_insert_rowid() function returns the ROWID of the last row insert from the database connection which invoked the function. The last_insert_rowid() SQL function is a wrapper around the sqlite3_last_insert_rowid() C/C++ numbererface function.*/
|
|
@@ -76,8 +83,6 @@ export type SqliteFunctions = {
|
|
|
76
83
|
upper(x: EV<string>): Expr<string>;
|
|
77
84
|
/** The avg() function returns the average value of all non-NULL X within a group. string and BLOB values that do not look like numbers are numbererpreted as 0. The result of avg() is always a numbering ponumber value as long as at there is at least one non-NULL input even if all inputs are numberegers. The result of avg() is NULL if and only if there are no non-NULL inputs. */
|
|
78
85
|
avg(x: Expr<number>): Expr<number>;
|
|
79
|
-
/** The count(X) function returns a count of the number of times that X is not NULL in a group. The count(*) function (with no arguments) returns the total number of rows in the group. */
|
|
80
|
-
count(x?: Expr<any>): Expr<number>;
|
|
81
86
|
/** The group_concat() function returns a string which is the concatenation of all non-NULL values of X. If parameter Y is present then it is used as the separator between instances of X. A comma (",") is used as the separator if Y is omitted. The order of the concatenated elements is arbitrary. */
|
|
82
87
|
group_concat(x: EV<string>, y: EV<string>): Expr<string>;
|
|
83
88
|
/** The sum() and total() aggregate functions return sum of all non-NULL values in the group. If there are no non-NULL input rows then sum() returns NULL but total() returns 0.0. NULL is not normally a helpful result for the sum of no rows but the SQL standard requires it and most other SQL database engines implement sum() that way so SQLite does it in the same way in order to be compatible. The non-standard total() function is provided as a convenient way to work around this design problem in the SQL language.
|
|
@@ -148,9 +153,9 @@ export type SqliteFunctions = {
|
|
|
148
153
|
julianday(timeValue: EV<any>, ...rest: Array<EV<string>>): Expr<string>;
|
|
149
154
|
strftime(format: EV<string>, timeValue: EV<any>, ...rest: Array<EV<string>>): Expr<string>;
|
|
150
155
|
};
|
|
151
|
-
export declare const match: (table: Table<any>, searchTerm: EV<string>) => Expr<boolean>, cast: {
|
|
156
|
+
export declare const count: (x?: Expr<any>) => Expr<number>, iif: <T>(x: EV<boolean>, y: EV<T>, z: EV<T>) => Expr<T>, exists: (cursor: Cursor<any>) => Expr<boolean>, match: (table: Table<any>, searchTerm: EV<string>) => Expr<boolean>, cast: {
|
|
152
157
|
(x: EV<any>, type: 'text'): Expr<string>;
|
|
153
158
|
(x: EV<any>, type: 'real'): Expr<number>;
|
|
154
159
|
(x: EV<any>, type: 'integer'): Expr<number>;
|
|
155
160
|
(x: EV<any>, type: 'numeric'): Expr<number>;
|
|
156
|
-
}, abs: (x: EV<number>) => Expr<number>, changes: () => Expr<number>, char: (...arg: Array<EV<number>>) => Expr<string>, coalesce: (x: EV<any>, y: EV<any>, ...rest: EV<any>) => Expr<any>, ifnull: <T>(x: EV<T>, y: EV<T>) => Expr<T>,
|
|
161
|
+
}, abs: (x: EV<number>) => Expr<number>, changes: () => Expr<number>, char: (...arg: Array<EV<number>>) => Expr<string>, coalesce: (x: EV<any>, y: EV<any>, ...rest: EV<any>) => Expr<any>, ifnull: <T>(x: EV<T>, y: EV<T>) => Expr<T>, instr: (x: EV<string>, y: EV<string>) => Expr<number>, last_insert_rowid: () => Expr<number>, length: (x: EV<string>) => Expr<number>, likelihood: (x: EV<boolean>, y: number) => Expr<boolean>, likely: (x: EV<boolean>) => Expr<boolean>, lower: (x: EV<string>) => Expr<string>, ltrim: (x: EV<string>, y?: EV<string>) => Expr<string>, max: <T>(x: EV<T>, y: EV<T>, ...rest: EV<T>[]) => Expr<T>, min: <T>(x: EV<T>, y: EV<T>, ...rest: EV<T>[]) => Expr<T>, nullif: <T>(x: EV<T>, y: EV<T>) => Expr<T | null>, prnumberf: (format: string, ...rest: Array<Expr<any>>) => Expr<string>, quote: (x: EV<string>) => Expr<string>, random: () => Expr<number>, replace: (x: EV<string>, y: EV<string>, z: EV<string>) => Expr<string>, round: (x: EV<number>, y?: EV<number>) => Expr<number>, rtrim: (x: EV<string>, y?: EV<string>) => Expr<string>, sign: (x: EV<number>) => Expr<number>, soundex: (x: EV<string>) => Expr<string>, sqlite_version: () => Expr<string>, substr: (x: EV<string>, y: EV<number>, z?: EV<number>) => Expr<string>, total_changes: () => Expr<number>, trim: (x: EV<string>, Y: EV<string>) => Expr<string>, unicode: (x: EV<string>) => Expr<number>, unlikely: (x: EV<boolean>) => Expr<boolean>, upper: (x: EV<string>) => Expr<string>, avg: (x: Expr<number>) => Expr<number>, group_concat: (x: EV<string>, y: EV<string>) => Expr<string>, sum: (x: EV<number>) => Expr<number>, acos: (x: EV<number>) => Expr<number>, acosh: (x: EV<number>) => Expr<number>, asin: (x: EV<number>) => Expr<number>, asinh: (x: EV<number>) => Expr<number>, atan: (x: EV<number>) => Expr<number>, atan2: (x: EV<number>, y: EV<number>) => Expr<number>, atanh: (x: EV<number>) => Expr<number>, ceil: (x: EV<number>) => Expr<number>, cos: (x: EV<number>) => Expr<number>, cosh: (x: EV<number>) => Expr<number>, degrees: (x: EV<number>) => Expr<number>, exp: (x: EV<number>) => Expr<number>, floor: (x: EV<number>) => Expr<number>, ln: (x: EV<number>) => Expr<number>, log: (x: EV<number>, y?: EV<number>) => Expr<number>, log2: (x: EV<number>) => Expr<number>, mod: (x: EV<number>, y: EV<number>) => Expr<number>, pi: (x: EV<number>) => Expr<number>, pow: (x: EV<number>, y: EV<number>) => Expr<number>, radians: (x: EV<number>) => Expr<number>, sin: (x: EV<number>) => Expr<number>, sinh: (x: EV<number>) => Expr<number>, sqrt: (x: EV<number>) => Expr<number>, tan: (x: EV<number>) => Expr<number>, tanh: (x: EV<number>) => Expr<number>, trunc: (x: EV<number>) => Expr<number>, date: (timeValue: EV<any>, ...rest: Array<EV<string>>) => Expr<string>, time: (timeValue: EV<any>, ...rest: Array<EV<string>>) => Expr<string>, datetime: (timeValue: EV<any>, ...rest: Array<EV<string>>) => Expr<string>, julianday: (timeValue: EV<any>, ...rest: Array<EV<string>>) => Expr<string>, strftime: (format: EV<string>, timeValue: EV<any>, ...rest: Array<EV<string>>) => Expr<string>;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { Functions } from "../lib/Functions.js";
|
|
3
3
|
var SqliteFunctions = Functions;
|
|
4
4
|
var {
|
|
5
|
+
count,
|
|
6
|
+
iif,
|
|
7
|
+
exists,
|
|
5
8
|
match,
|
|
6
9
|
cast,
|
|
7
10
|
abs,
|
|
@@ -9,7 +12,6 @@ var {
|
|
|
9
12
|
char,
|
|
10
13
|
coalesce,
|
|
11
14
|
ifnull,
|
|
12
|
-
iif,
|
|
13
15
|
instr,
|
|
14
16
|
last_insert_rowid,
|
|
15
17
|
length,
|
|
@@ -36,7 +38,6 @@ var {
|
|
|
36
38
|
unlikely,
|
|
37
39
|
upper,
|
|
38
40
|
avg,
|
|
39
|
-
count,
|
|
40
41
|
group_concat,
|
|
41
42
|
sum,
|
|
42
43
|
acos,
|
|
@@ -93,6 +94,7 @@ export {
|
|
|
93
94
|
date,
|
|
94
95
|
datetime,
|
|
95
96
|
degrees,
|
|
97
|
+
exists,
|
|
96
98
|
exp,
|
|
97
99
|
floor,
|
|
98
100
|
group_concat,
|