@duckdb/node-api 1.4.4-r.1 → 1.4.4-r.2
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/lib/DuckDBBindInfo.d.ts +12 -0
- package/lib/DuckDBBindInfo.js +33 -0
- package/lib/DuckDBConnection.d.ts +1 -0
- package/lib/DuckDBConnection.js +3 -0
- package/lib/DuckDBFunctionInfo.d.ts +3 -0
- package/lib/DuckDBFunctionInfo.js +9 -0
- package/lib/DuckDBScalarFunction.d.ts +5 -1
- package/lib/DuckDBScalarFunction.js +11 -1
- package/lib/duckdb.d.ts +1 -0
- package/lib/duckdb.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import duckdb from '@duckdb/node-bindings';
|
|
2
|
+
import { DuckDBClientContext } from './DuckDBClientContext';
|
|
3
|
+
export declare class DuckDBBindInfo {
|
|
4
|
+
private readonly bind_info;
|
|
5
|
+
constructor(bind_info: duckdb.BindInfo);
|
|
6
|
+
get clientContext(): DuckDBClientContext;
|
|
7
|
+
getClientContext(): DuckDBClientContext;
|
|
8
|
+
get extraInfo(): object | undefined;
|
|
9
|
+
getExtraInfo(): object | undefined;
|
|
10
|
+
setBindData(bindData: object): void;
|
|
11
|
+
setError(error: string): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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.DuckDBBindInfo = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@duckdb/node-bindings"));
|
|
8
|
+
const DuckDBClientContext_1 = require("./DuckDBClientContext");
|
|
9
|
+
class DuckDBBindInfo {
|
|
10
|
+
bind_info;
|
|
11
|
+
constructor(bind_info) {
|
|
12
|
+
this.bind_info = bind_info;
|
|
13
|
+
}
|
|
14
|
+
get clientContext() {
|
|
15
|
+
return this.getClientContext();
|
|
16
|
+
}
|
|
17
|
+
getClientContext() {
|
|
18
|
+
return new DuckDBClientContext_1.DuckDBClientContext(node_bindings_1.default.scalar_function_get_client_context(this.bind_info));
|
|
19
|
+
}
|
|
20
|
+
get extraInfo() {
|
|
21
|
+
return this.getExtraInfo();
|
|
22
|
+
}
|
|
23
|
+
getExtraInfo() {
|
|
24
|
+
return node_bindings_1.default.scalar_function_bind_get_extra_info(this.bind_info);
|
|
25
|
+
}
|
|
26
|
+
setBindData(bindData) {
|
|
27
|
+
node_bindings_1.default.scalar_function_set_bind_data(this.bind_info, bindData);
|
|
28
|
+
}
|
|
29
|
+
setError(error) {
|
|
30
|
+
node_bindings_1.default.scalar_function_bind_set_error(this.bind_info, error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DuckDBBindInfo = DuckDBBindInfo;
|
|
@@ -20,6 +20,7 @@ export declare class DuckDBConnection {
|
|
|
20
20
|
closeSync(): void;
|
|
21
21
|
disconnectSync(): void;
|
|
22
22
|
get clientContext(): DuckDBClientContext;
|
|
23
|
+
getClientContext(): DuckDBClientContext;
|
|
23
24
|
interrupt(): void;
|
|
24
25
|
get progress(): duckdb.QueryProgress;
|
|
25
26
|
run(sql: string, values?: DuckDBValue[] | Record<string, DuckDBValue>, types?: DuckDBType[] | Record<string, DuckDBType | undefined>): Promise<DuckDBMaterializedResult>;
|
package/lib/DuckDBConnection.js
CHANGED
|
@@ -35,6 +35,9 @@ class DuckDBConnection {
|
|
|
35
35
|
node_bindings_1.default.disconnect_sync(this.connection);
|
|
36
36
|
}
|
|
37
37
|
get clientContext() {
|
|
38
|
+
return this.getClientContext();
|
|
39
|
+
}
|
|
40
|
+
getClientContext() {
|
|
38
41
|
return new DuckDBClientContext_1.DuckDBClientContext(node_bindings_1.default.connection_get_client_context(this.connection));
|
|
39
42
|
}
|
|
40
43
|
interrupt() {
|
|
@@ -2,6 +2,9 @@ import duckdb from '@duckdb/node-bindings';
|
|
|
2
2
|
export declare class DuckDBFunctionInfo {
|
|
3
3
|
private readonly function_info;
|
|
4
4
|
constructor(function_info: duckdb.FunctionInfo);
|
|
5
|
+
get bindData(): object | undefined;
|
|
6
|
+
getBindData(): object | undefined;
|
|
7
|
+
get extraInfo(): object | undefined;
|
|
5
8
|
getExtraInfo(): object | undefined;
|
|
6
9
|
setError(error: string): void;
|
|
7
10
|
}
|
|
@@ -10,6 +10,15 @@ class DuckDBFunctionInfo {
|
|
|
10
10
|
constructor(function_info) {
|
|
11
11
|
this.function_info = function_info;
|
|
12
12
|
}
|
|
13
|
+
get bindData() {
|
|
14
|
+
return this.getBindData();
|
|
15
|
+
}
|
|
16
|
+
getBindData() {
|
|
17
|
+
return node_bindings_1.default.scalar_function_get_bind_data(this.function_info);
|
|
18
|
+
}
|
|
19
|
+
get extraInfo() {
|
|
20
|
+
return this.getExtraInfo();
|
|
21
|
+
}
|
|
13
22
|
getExtraInfo() {
|
|
14
23
|
return node_bindings_1.default.scalar_function_get_extra_info(this.function_info);
|
|
15
24
|
}
|
|
@@ -3,12 +3,15 @@ import { DuckDBDataChunk } from './DuckDBDataChunk';
|
|
|
3
3
|
import { DuckDBFunctionInfo } from './DuckDBFunctionInfo';
|
|
4
4
|
import { DuckDBType } from './DuckDBType';
|
|
5
5
|
import { DuckDBVector } from './DuckDBVector';
|
|
6
|
+
import { DuckDBBindInfo } from './DuckDBBindInfo';
|
|
7
|
+
export type DuckDBScalarBindFunction = (bindInfo: DuckDBBindInfo) => void;
|
|
6
8
|
export type DuckDBScalarMainFunction = (functionInfo: DuckDBFunctionInfo, inputDataChunk: DuckDBDataChunk, outputVector: DuckDBVector) => void;
|
|
7
9
|
export declare class DuckDBScalarFunction {
|
|
8
10
|
readonly scalar_function: duckdb.ScalarFunction;
|
|
9
11
|
constructor();
|
|
10
|
-
static create({ name, mainFunction, returnType, parameterTypes, varArgsType, specialHandling, volatile, extraInfo, }: {
|
|
12
|
+
static create({ name, bindFunction, mainFunction, returnType, parameterTypes, varArgsType, specialHandling, volatile, extraInfo, }: {
|
|
11
13
|
name: string;
|
|
14
|
+
bindFunction?: DuckDBScalarBindFunction;
|
|
12
15
|
mainFunction: DuckDBScalarMainFunction;
|
|
13
16
|
returnType: DuckDBType;
|
|
14
17
|
parameterTypes?: readonly DuckDBType[];
|
|
@@ -19,6 +22,7 @@ export declare class DuckDBScalarFunction {
|
|
|
19
22
|
}): DuckDBScalarFunction;
|
|
20
23
|
destroySync(): void;
|
|
21
24
|
setName(name: string): void;
|
|
25
|
+
setBindFunction(bindFunction: DuckDBScalarBindFunction): void;
|
|
22
26
|
setMainFunction(mainFunction: DuckDBScalarMainFunction): void;
|
|
23
27
|
setReturnType(returnType: DuckDBType): void;
|
|
24
28
|
addParameter(parameterType: DuckDBType): void;
|
|
@@ -8,14 +8,18 @@ const node_bindings_1 = __importDefault(require("@duckdb/node-bindings"));
|
|
|
8
8
|
const DuckDBDataChunk_1 = require("./DuckDBDataChunk");
|
|
9
9
|
const DuckDBFunctionInfo_1 = require("./DuckDBFunctionInfo");
|
|
10
10
|
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBBindInfo_1 = require("./DuckDBBindInfo");
|
|
11
12
|
class DuckDBScalarFunction {
|
|
12
13
|
scalar_function;
|
|
13
14
|
constructor() {
|
|
14
15
|
this.scalar_function = node_bindings_1.default.create_scalar_function();
|
|
15
16
|
}
|
|
16
|
-
static create({ name, mainFunction, returnType, parameterTypes, varArgsType, specialHandling, volatile, extraInfo, }) {
|
|
17
|
+
static create({ name, bindFunction, mainFunction, returnType, parameterTypes, varArgsType, specialHandling, volatile, extraInfo, }) {
|
|
17
18
|
const scalarFunction = new DuckDBScalarFunction();
|
|
18
19
|
scalarFunction.setName(name);
|
|
20
|
+
if (bindFunction) {
|
|
21
|
+
scalarFunction.setBindFunction(bindFunction);
|
|
22
|
+
}
|
|
19
23
|
scalarFunction.setMainFunction(mainFunction);
|
|
20
24
|
scalarFunction.setReturnType(returnType);
|
|
21
25
|
if (parameterTypes) {
|
|
@@ -43,6 +47,12 @@ class DuckDBScalarFunction {
|
|
|
43
47
|
setName(name) {
|
|
44
48
|
node_bindings_1.default.scalar_function_set_name(this.scalar_function, name);
|
|
45
49
|
}
|
|
50
|
+
setBindFunction(bindFunction) {
|
|
51
|
+
node_bindings_1.default.scalar_function_set_bind(this.scalar_function, (info) => {
|
|
52
|
+
const bindInfo = new DuckDBBindInfo_1.DuckDBBindInfo(info);
|
|
53
|
+
bindFunction(bindInfo);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
46
56
|
setMainFunction(mainFunction) {
|
|
47
57
|
node_bindings_1.default.scalar_function_set_function(this.scalar_function, (info, input, output) => {
|
|
48
58
|
const functionInfo = new DuckDBFunctionInfo_1.DuckDBFunctionInfo(info);
|
package/lib/duckdb.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { double_to_hugeint, double_to_uhugeint, hugeint_to_double, uhugeint_to_d
|
|
|
2
2
|
export * from './configurationOptionDescriptions';
|
|
3
3
|
export * from './createDuckDBValueConverter';
|
|
4
4
|
export * from './DuckDBAppender';
|
|
5
|
+
export * from './DuckDBBindInfo';
|
|
5
6
|
export * from './DuckDBClientContext';
|
|
6
7
|
export * from './DuckDBConnection';
|
|
7
8
|
export * from './DuckDBDataChunk';
|
package/lib/duckdb.js
CHANGED
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "uhugeint_to_double", { enumerable: true, get: fu
|
|
|
23
23
|
__exportStar(require("./configurationOptionDescriptions"), exports);
|
|
24
24
|
__exportStar(require("./createDuckDBValueConverter"), exports);
|
|
25
25
|
__exportStar(require("./DuckDBAppender"), exports);
|
|
26
|
+
__exportStar(require("./DuckDBBindInfo"), exports);
|
|
26
27
|
__exportStar(require("./DuckDBClientContext"), exports);
|
|
27
28
|
__exportStar(require("./DuckDBConnection"), exports);
|
|
28
29
|
__exportStar(require("./DuckDBDataChunk"), exports);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duckdb/node-api",
|
|
3
|
-
"version": "1.4.4-r.
|
|
3
|
+
"version": "1.4.4-r.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@duckdb/node-bindings": "1.4.4-r.
|
|
8
|
+
"@duckdb/node-bindings": "1.4.4-r.2"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|