metal-orm 1.0.62 → 1.0.64
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/README.md +10 -8
- package/dist/index.cjs +187 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +844 -422
- package/dist/index.d.ts +844 -422
- package/dist/index.js +184 -119
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/ast/aggregate-functions.ts +13 -4
- package/src/core/ast/expression-builders.ts +325 -111
- package/src/core/ast/expression.ts +9 -0
- package/src/core/ast/window-functions.ts +62 -52
- package/src/core/functions/array.ts +12 -3
- package/src/core/functions/control-flow.ts +28 -18
- package/src/core/functions/datetime.ts +113 -84
- package/src/core/functions/json.ts +40 -8
- package/src/core/functions/numeric.ts +116 -79
- package/src/core/functions/text.ts +181 -114
- package/src/decorators/bootstrap.ts +23 -19
- package/src/query-builder/hydration-planner.ts +14 -16
- package/src/query-builder/select.ts +91 -55
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ColumnDef } from '../../schema/column-types.js';
|
|
4
4
|
import { columnOperand, valueToOperand } from '../ast/expression-builders.js';
|
|
5
|
-
import { FunctionNode, OperandNode, isOperandNode } from '../ast/expression.js';
|
|
5
|
+
import { FunctionNode, OperandNode, isOperandNode, TypedExpression, asType } from '../ast/expression.js';
|
|
6
6
|
|
|
7
7
|
type OperandInput = OperandNode | ColumnDef | string | number | boolean | null;
|
|
8
8
|
|
|
@@ -22,17 +22,49 @@ const fn = (key: string, args: OperandInput[]): FunctionNode => ({
|
|
|
22
22
|
args: args.map(toOperand)
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const nfn = (key: string, args: OperandInput[]): TypedExpression<number> => asType<number>(fn(key, args));
|
|
26
|
+
const afn = <T = any>(key: string, args: OperandInput[]): TypedExpression<T> => asType<T>(fn(key, args));
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Returns the number of elements in a JSON array or object.
|
|
30
|
+
*
|
|
31
|
+
* @param target - JSON column or value.
|
|
32
|
+
* @param path - Optional JSON path.
|
|
33
|
+
* @returns A `TypedExpression<number>` representing the `JSON_LENGTH` SQL function.
|
|
34
|
+
*/
|
|
35
|
+
export const jsonLength = (target: OperandInput, path?: OperandInput): TypedExpression<number> =>
|
|
36
|
+
path === undefined ? nfn('JSON_LENGTH', [target]) : nfn('JSON_LENGTH', [target, path]);
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Inserts or updates a value in a JSON document.
|
|
40
|
+
*
|
|
41
|
+
* @param target - JSON column or value.
|
|
42
|
+
* @param path - JSON path to set.
|
|
43
|
+
* @param value - Value to set.
|
|
44
|
+
* @returns A `TypedExpression<any>` representing the `JSON_SET` SQL function.
|
|
45
|
+
*/
|
|
46
|
+
export const jsonSet = (target: OperandInput, path: OperandInput, value: OperandInput): TypedExpression<any> =>
|
|
47
|
+
afn('JSON_SET', [target, path, value]);
|
|
32
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Aggregates values into a JSON array.
|
|
51
|
+
*
|
|
52
|
+
* @param value - Column or expression to aggregate.
|
|
53
|
+
* @returns A `TypedExpression<any[]>` representing the `JSON_ARRAYAGG` SQL function.
|
|
54
|
+
*/
|
|
55
|
+
export const jsonArrayAgg = (value: OperandInput): TypedExpression<any[]> => afn<any[]>('JSON_ARRAYAGG', [value]);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a JSON document contains a specific piece of data.
|
|
59
|
+
*
|
|
60
|
+
* @param target - JSON column or value.
|
|
61
|
+
* @param candidate - Data to look for.
|
|
62
|
+
* @param path - Optional JSON path to search within.
|
|
63
|
+
* @returns A `TypedExpression<boolean>` representing the `JSON_CONTAINS` SQL function.
|
|
64
|
+
*/
|
|
33
65
|
export const jsonContains = (
|
|
34
66
|
target: OperandInput,
|
|
35
67
|
candidate: OperandInput,
|
|
36
68
|
path?: OperandInput
|
|
37
|
-
):
|
|
38
|
-
path === undefined ?
|
|
69
|
+
): TypedExpression<boolean> =>
|
|
70
|
+
path === undefined ? afn<boolean>('JSON_CONTAINS', [target, candidate]) : afn<boolean>('JSON_CONTAINS', [target, candidate, path]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ColumnDef } from '../../schema/column-types.js';
|
|
4
4
|
import { columnOperand, valueToOperand } from '../ast/expression-builders.js';
|
|
5
|
-
import { FunctionNode, OperandNode, isOperandNode } from '../ast/expression.js';
|
|
5
|
+
import { FunctionNode, OperandNode, isOperandNode, TypedExpression, asType } from '../ast/expression.js';
|
|
6
6
|
|
|
7
7
|
type OperandInput = OperandNode | ColumnDef | string | number | boolean | null;
|
|
8
8
|
|
|
@@ -22,239 +22,276 @@ const fn = (key: string, args: OperandInput[]): FunctionNode => ({
|
|
|
22
22
|
args: args.map(toOperand)
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
const nfn = (key: string, args: OperandInput[]): TypedExpression<number> => asType<number>(fn(key, args));
|
|
26
|
+
|
|
25
27
|
// ----------------------
|
|
26
28
|
// Helper Functions
|
|
27
29
|
// ----------------------
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Returns the absolute value of a number.
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
+
*
|
|
34
|
+
* @param value - The numeric value or column.
|
|
35
|
+
* @returns A `TypedExpression<number>` representing the `ABS` SQL function.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* abs(transactions.amount);
|
|
33
39
|
*/
|
|
34
|
-
export const abs = (value: OperandInput):
|
|
40
|
+
export const abs = (value: OperandInput): TypedExpression<number> => nfn('ABS', [value]);
|
|
35
41
|
|
|
36
42
|
/**
|
|
37
43
|
* Returns the arccosine (inverse cosine) of a number.
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
44
|
+
*
|
|
45
|
+
* @param value - The numeric value or column.
|
|
46
|
+
* @returns A `TypedExpression<number>` representing the `ACOS` SQL function.
|
|
40
47
|
*/
|
|
41
|
-
export const acos = (value: OperandInput):
|
|
48
|
+
export const acos = (value: OperandInput): TypedExpression<number> => nfn('ACOS', [value]);
|
|
42
49
|
|
|
43
50
|
/**
|
|
44
51
|
* Returns the arcsine (inverse sine) of a number.
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
52
|
+
*
|
|
53
|
+
* @param value - The numeric value or column.
|
|
54
|
+
* @returns A `TypedExpression<number>` representing the `ASIN` SQL function.
|
|
47
55
|
*/
|
|
48
|
-
export const asin = (value: OperandInput):
|
|
56
|
+
export const asin = (value: OperandInput): TypedExpression<number> => nfn('ASIN', [value]);
|
|
49
57
|
|
|
50
58
|
/**
|
|
51
59
|
* Returns the arctangent (inverse tangent) of a number.
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
60
|
+
*
|
|
61
|
+
* @param value - The numeric value or column.
|
|
62
|
+
* @returns A `TypedExpression<number>` representing the `ATAN` SQL function.
|
|
54
63
|
*/
|
|
55
|
-
export const atan = (value: OperandInput):
|
|
64
|
+
export const atan = (value: OperandInput): TypedExpression<number> => nfn('ATAN', [value]);
|
|
56
65
|
|
|
57
66
|
/**
|
|
58
67
|
* Returns the arctangent of the two arguments.
|
|
68
|
+
*
|
|
59
69
|
* @param y - The y-coordinate.
|
|
60
70
|
* @param x - The x-coordinate.
|
|
61
|
-
* @returns A
|
|
71
|
+
* @returns A `TypedExpression<number>` representing the `ATAN2` SQL function.
|
|
62
72
|
*/
|
|
63
|
-
export const atan2 = (y: OperandInput, x: OperandInput):
|
|
73
|
+
export const atan2 = (y: OperandInput, x: OperandInput): TypedExpression<number> => nfn('ATAN2', [y, x]);
|
|
64
74
|
|
|
65
75
|
/**
|
|
66
76
|
* Returns the smallest integer greater than or equal to a number.
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
77
|
+
*
|
|
78
|
+
* @param value - The numeric value or column.
|
|
79
|
+
* @returns A `TypedExpression<number>` representing the `CEIL` SQL function.
|
|
69
80
|
*/
|
|
70
|
-
export const ceil = (value: OperandInput):
|
|
81
|
+
export const ceil = (value: OperandInput): TypedExpression<number> => nfn('CEIL', [value]);
|
|
71
82
|
|
|
72
83
|
/**
|
|
73
84
|
* Alias for ceil. Returns the smallest integer greater than or equal to a number.
|
|
74
|
-
*
|
|
75
|
-
* @
|
|
85
|
+
*
|
|
86
|
+
* @param value - The numeric value or column.
|
|
87
|
+
* @returns A `TypedExpression<number>` representing the `CEILING` SQL function.
|
|
76
88
|
*/
|
|
77
|
-
export const ceiling = (value: OperandInput):
|
|
89
|
+
export const ceiling = (value: OperandInput): TypedExpression<number> => nfn('CEILING', [value]);
|
|
78
90
|
|
|
79
91
|
/**
|
|
80
92
|
* Returns the cosine of a number (in radians).
|
|
93
|
+
*
|
|
81
94
|
* @param value - The numeric value in radians.
|
|
82
|
-
* @returns A
|
|
95
|
+
* @returns A `TypedExpression<number>` representing the `COS` SQL function.
|
|
83
96
|
*/
|
|
84
|
-
export const cos = (value: OperandInput):
|
|
97
|
+
export const cos = (value: OperandInput): TypedExpression<number> => nfn('COS', [value]);
|
|
85
98
|
|
|
86
99
|
/**
|
|
87
100
|
* Returns the cotangent of a number.
|
|
101
|
+
*
|
|
88
102
|
* @param value - The numeric value.
|
|
89
|
-
* @returns A
|
|
103
|
+
* @returns A `TypedExpression<number>` representing the `COT` SQL function.
|
|
90
104
|
*/
|
|
91
|
-
export const cot = (value: OperandInput):
|
|
105
|
+
export const cot = (value: OperandInput): TypedExpression<number> => nfn('COT', [value]);
|
|
92
106
|
|
|
93
107
|
/**
|
|
94
108
|
* Converts radians to degrees.
|
|
109
|
+
*
|
|
95
110
|
* @param value - The angle in radians.
|
|
96
|
-
* @returns A
|
|
111
|
+
* @returns A `TypedExpression<number>` representing the `DEGREES` SQL function.
|
|
97
112
|
*/
|
|
98
|
-
export const degrees = (value: OperandInput):
|
|
113
|
+
export const degrees = (value: OperandInput): TypedExpression<number> => nfn('DEGREES', [value]);
|
|
99
114
|
|
|
100
115
|
/**
|
|
101
116
|
* Returns e raised to the power of the argument.
|
|
117
|
+
*
|
|
102
118
|
* @param value - The exponent.
|
|
103
|
-
* @returns A
|
|
119
|
+
* @returns A `TypedExpression<number>` representing the `EXP` SQL function.
|
|
104
120
|
*/
|
|
105
|
-
export const exp = (value: OperandInput):
|
|
121
|
+
export const exp = (value: OperandInput): TypedExpression<number> => nfn('EXP', [value]);
|
|
106
122
|
|
|
107
123
|
/**
|
|
108
124
|
* Returns the largest integer less than or equal to a number.
|
|
125
|
+
*
|
|
109
126
|
* @param value - The numeric value.
|
|
110
|
-
* @returns A
|
|
127
|
+
* @returns A `TypedExpression<number>` representing the `FLOOR` SQL function.
|
|
111
128
|
*/
|
|
112
|
-
export const floor = (value: OperandInput):
|
|
129
|
+
export const floor = (value: OperandInput): TypedExpression<number> => nfn('FLOOR', [value]);
|
|
113
130
|
|
|
114
131
|
/**
|
|
115
132
|
* Returns the natural logarithm (base e) of a number.
|
|
133
|
+
*
|
|
116
134
|
* @param value - The numeric value.
|
|
117
|
-
* @returns A
|
|
135
|
+
* @returns A `TypedExpression<number>` representing the `LN` SQL function.
|
|
118
136
|
*/
|
|
119
|
-
export const ln = (value: OperandInput):
|
|
137
|
+
export const ln = (value: OperandInput): TypedExpression<number> => nfn('LN', [value]);
|
|
120
138
|
|
|
121
139
|
/**
|
|
122
140
|
* Returns the base-10 logarithm of a number.
|
|
141
|
+
*
|
|
123
142
|
* @param value - The numeric value.
|
|
124
|
-
* @returns A
|
|
143
|
+
* @returns A `TypedExpression<number>` representing the `LOG` SQL function.
|
|
125
144
|
*/
|
|
126
|
-
export const log = (value: OperandInput):
|
|
145
|
+
export const log = (value: OperandInput): TypedExpression<number> => nfn('LOG', [value]);
|
|
127
146
|
|
|
128
147
|
/**
|
|
129
148
|
* Returns the base-10 logarithm of a number.
|
|
149
|
+
*
|
|
130
150
|
* @param value - The numeric value.
|
|
131
|
-
* @returns A
|
|
151
|
+
* @returns A `TypedExpression<number>` representing the `LOG10` SQL function.
|
|
132
152
|
*/
|
|
133
|
-
export const log10 = (value: OperandInput):
|
|
153
|
+
export const log10 = (value: OperandInput): TypedExpression<number> => nfn('LOG10', [value]);
|
|
134
154
|
|
|
135
155
|
/**
|
|
136
156
|
* Returns the logarithm of a number for a specific base.
|
|
157
|
+
*
|
|
137
158
|
* @param base - The base of the logarithm.
|
|
138
159
|
* @param value - The numeric value.
|
|
139
|
-
* @returns A
|
|
160
|
+
* @returns A `TypedExpression<number>` representing the `LOG_BASE` SQL function.
|
|
140
161
|
*/
|
|
141
|
-
export const logBase = (base: OperandInput, value: OperandInput):
|
|
162
|
+
export const logBase = (base: OperandInput, value: OperandInput): TypedExpression<number> => nfn('LOG_BASE', [base, value]);
|
|
142
163
|
|
|
143
164
|
/**
|
|
144
165
|
* Returns the remainder of dividing x by y.
|
|
166
|
+
*
|
|
145
167
|
* @param x - The dividend.
|
|
146
168
|
* @param y - The divisor.
|
|
147
|
-
* @returns A
|
|
169
|
+
* @returns A `TypedExpression<number>` representing the `MOD` SQL function.
|
|
148
170
|
*/
|
|
149
|
-
export const mod = (x: OperandInput, y: OperandInput):
|
|
171
|
+
export const mod = (x: OperandInput, y: OperandInput): TypedExpression<number> => nfn('MOD', [x, y]);
|
|
150
172
|
|
|
151
173
|
/**
|
|
152
174
|
* Returns the value of PI (approximately 3.14159...).
|
|
153
|
-
*
|
|
175
|
+
*
|
|
176
|
+
* @returns A `TypedExpression<number>` representing the `PI` SQL function.
|
|
154
177
|
*/
|
|
155
|
-
export const pi = ():
|
|
178
|
+
export const pi = (): TypedExpression<number> => nfn('PI', []);
|
|
156
179
|
|
|
157
180
|
/**
|
|
158
181
|
* Returns x raised to the power of y.
|
|
182
|
+
*
|
|
159
183
|
* @param x - The base.
|
|
160
184
|
* @param y - The exponent.
|
|
161
|
-
* @returns A
|
|
185
|
+
* @returns A `TypedExpression<number>` representing the `POWER` SQL function.
|
|
162
186
|
*/
|
|
163
|
-
export const power = (x: OperandInput, y: OperandInput):
|
|
187
|
+
export const power = (x: OperandInput, y: OperandInput): TypedExpression<number> => nfn('POWER', [x, y]);
|
|
164
188
|
|
|
165
189
|
/**
|
|
166
190
|
* Alias for power. Returns x raised to the power of y.
|
|
191
|
+
*
|
|
167
192
|
* @param x - The base.
|
|
168
193
|
* @param y - The exponent.
|
|
169
|
-
* @returns A
|
|
194
|
+
* @returns A `TypedExpression<number>` representing the `POW` SQL function.
|
|
170
195
|
*/
|
|
171
|
-
export const pow = (x: OperandInput, y: OperandInput):
|
|
196
|
+
export const pow = (x: OperandInput, y: OperandInput): TypedExpression<number> => nfn('POW', [x, y]);
|
|
172
197
|
|
|
173
198
|
/**
|
|
174
199
|
* Converts degrees to radians.
|
|
200
|
+
*
|
|
175
201
|
* @param value - The angle in degrees.
|
|
176
|
-
* @returns A
|
|
202
|
+
* @returns A `TypedExpression<number>` representing the `RADIANS` SQL function.
|
|
177
203
|
*/
|
|
178
|
-
export const radians = (value: OperandInput):
|
|
204
|
+
export const radians = (value: OperandInput): TypedExpression<number> => nfn('RADIANS', [value]);
|
|
179
205
|
|
|
180
206
|
/**
|
|
181
207
|
* Returns a random number between 0 and 1.
|
|
182
|
-
*
|
|
208
|
+
*
|
|
209
|
+
* @returns A `TypedExpression<number>` representing the `RANDOM` SQL function.
|
|
183
210
|
*/
|
|
184
|
-
export const random = ():
|
|
211
|
+
export const random = (): TypedExpression<number> => nfn('RANDOM', []);
|
|
185
212
|
|
|
186
213
|
/**
|
|
187
214
|
* Alias for random. Returns a random number between 0 and 1.
|
|
188
|
-
*
|
|
215
|
+
*
|
|
216
|
+
* @returns A `TypedExpression<number>` representing the `RAND` SQL function.
|
|
189
217
|
*/
|
|
190
|
-
export const rand = ():
|
|
218
|
+
export const rand = (): TypedExpression<number> => nfn('RAND', []);
|
|
191
219
|
|
|
192
220
|
/**
|
|
193
221
|
* Rounds a number to a specified number of decimal places.
|
|
222
|
+
*
|
|
194
223
|
* @param value - The numeric value to round.
|
|
195
|
-
* @param decimals -
|
|
196
|
-
* @returns A
|
|
224
|
+
* @param decimals - Optional number of decimal places.
|
|
225
|
+
* @returns A `TypedExpression<number>` representing the `ROUND` SQL function.
|
|
197
226
|
*/
|
|
198
|
-
export const round = (value: OperandInput, decimals?: OperandInput):
|
|
199
|
-
decimals === undefined ?
|
|
227
|
+
export const round = (value: OperandInput, decimals?: OperandInput): TypedExpression<number> =>
|
|
228
|
+
decimals === undefined ? nfn('ROUND', [value]) : nfn('ROUND', [value, decimals]);
|
|
200
229
|
|
|
201
230
|
/**
|
|
202
231
|
* Returns the sign of a number (-1 for negative, 0 for zero, 1 for positive).
|
|
232
|
+
*
|
|
203
233
|
* @param value - The numeric value.
|
|
204
|
-
* @returns A
|
|
234
|
+
* @returns A `TypedExpression<number>` representing the `SIGN` SQL function.
|
|
205
235
|
*/
|
|
206
|
-
export const sign = (value: OperandInput):
|
|
236
|
+
export const sign = (value: OperandInput): TypedExpression<number> => nfn('SIGN', [value]);
|
|
207
237
|
|
|
208
238
|
/**
|
|
209
239
|
* Returns the sine of a number (in radians).
|
|
240
|
+
*
|
|
210
241
|
* @param value - The numeric value in radians.
|
|
211
|
-
* @returns A
|
|
242
|
+
* @returns A `TypedExpression<number>` representing the `SIN` SQL function.
|
|
212
243
|
*/
|
|
213
|
-
export const sin = (value: OperandInput):
|
|
244
|
+
export const sin = (value: OperandInput): TypedExpression<number> => nfn('SIN', [value]);
|
|
214
245
|
|
|
215
246
|
/**
|
|
216
247
|
* Returns the square root of a number.
|
|
217
|
-
*
|
|
218
|
-
* @
|
|
248
|
+
*
|
|
249
|
+
* @param value - The numeric value or column.
|
|
250
|
+
* @returns A `TypedExpression<number>` representing the `SQRT` SQL function.
|
|
219
251
|
*/
|
|
220
|
-
export const sqrt = (value: OperandInput):
|
|
252
|
+
export const sqrt = (value: OperandInput): TypedExpression<number> => nfn('SQRT', [value]);
|
|
221
253
|
|
|
222
254
|
/**
|
|
223
255
|
* Returns the tangent of a number (in radians).
|
|
256
|
+
*
|
|
224
257
|
* @param value - The numeric value in radians.
|
|
225
|
-
* @returns A
|
|
258
|
+
* @returns A `TypedExpression<number>` representing the `TAN` SQL function.
|
|
226
259
|
*/
|
|
227
|
-
export const tan = (value: OperandInput):
|
|
260
|
+
export const tan = (value: OperandInput): TypedExpression<number> => nfn('TAN', [value]);
|
|
228
261
|
|
|
229
262
|
/**
|
|
230
263
|
* Truncates a number to a specified number of decimal places without rounding.
|
|
264
|
+
*
|
|
231
265
|
* @param value - The numeric value to truncate.
|
|
232
|
-
* @param decimals -
|
|
233
|
-
* @returns A
|
|
266
|
+
* @param decimals - Optional number of decimal places.
|
|
267
|
+
* @returns A `TypedExpression<number>` representing the `TRUNC` SQL function.
|
|
234
268
|
*/
|
|
235
|
-
export const trunc = (value: OperandInput, decimals?: OperandInput):
|
|
236
|
-
decimals === undefined ?
|
|
269
|
+
export const trunc = (value: OperandInput, decimals?: OperandInput): TypedExpression<number> =>
|
|
270
|
+
decimals === undefined ? nfn('TRUNC', [value]) : nfn('TRUNC', [value, decimals]);
|
|
237
271
|
|
|
238
272
|
/**
|
|
239
273
|
* Alias for trunc. Truncates a number to a specified number of decimal places without rounding.
|
|
274
|
+
*
|
|
240
275
|
* @param value - The numeric value to truncate.
|
|
241
276
|
* @param decimals - The number of decimal places.
|
|
242
|
-
* @returns A
|
|
277
|
+
* @returns A `TypedExpression<number>` representing the `TRUNCATE` SQL function.
|
|
243
278
|
*/
|
|
244
|
-
export const truncate = (value: OperandInput, decimals: OperandInput):
|
|
245
|
-
|
|
279
|
+
export const truncate = (value: OperandInput, decimals: OperandInput): TypedExpression<number> =>
|
|
280
|
+
nfn('TRUNCATE', [value, decimals]);
|
|
246
281
|
|
|
247
282
|
/**
|
|
248
283
|
* Returns the base-2 logarithm of a number.
|
|
249
|
-
*
|
|
250
|
-
* @
|
|
284
|
+
*
|
|
285
|
+
* @param value - The numeric value or column.
|
|
286
|
+
* @returns A `TypedExpression<number>` representing the `LOG2` SQL function.
|
|
251
287
|
*/
|
|
252
|
-
export const log2 = (value: OperandInput):
|
|
288
|
+
export const log2 = (value: OperandInput): TypedExpression<number> => nfn('LOG2', [value]);
|
|
253
289
|
|
|
254
290
|
/**
|
|
255
291
|
* Returns the cube root of a number.
|
|
256
|
-
*
|
|
257
|
-
* @
|
|
292
|
+
*
|
|
293
|
+
* @param value - The numeric value or column.
|
|
294
|
+
* @returns A `TypedExpression<number>` representing the `CBRT` SQL function.
|
|
258
295
|
*/
|
|
259
|
-
export const cbrt = (value: OperandInput):
|
|
296
|
+
export const cbrt = (value: OperandInput): TypedExpression<number> => nfn('CBRT', [value]);
|
|
260
297
|
|