jsql-neo 3.5.2 → 4.0.1
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 +202 -0
- package/README.md +68 -56
- package/bin/jsql +97 -0
- package/index.js +20 -0
- package/lib/database.js +484 -28
- package/lib/mod.js +316 -0
- package/lib/mysql_compat.js +232 -0
- package/lib/mysql_server.js +514 -0
- package/lib/native_client.js +470 -0
- package/lib/nedb_compat.js +506 -0
- package/lib/plugin.js +35 -0
- package/lib/sql.js +1160 -0
- package/lib/table.js +42 -21
- package/lib/wasm_client.js +176 -8
- package/native/jsql-neo-native.node +0 -0
- package/nativesrc/jsql-neo-core/Cargo.toml +24 -0
- package/nativesrc/jsql-neo-core/src/engine/hybrid.rs +449 -0
- package/nativesrc/jsql-neo-core/src/engine/memory.rs +147 -0
- package/nativesrc/jsql-neo-core/src/engine/mod.rs +41 -0
- package/nativesrc/jsql-neo-core/src/engine/table.rs +664 -0
- package/nativesrc/jsql-neo-core/src/lib.rs +3 -0
- package/nativesrc/jsql-neo-core/src/storage/mod.rs +1 -0
- package/nativesrc/jsql-neo-core/src/storage/persistent.rs +2 -0
- package/nativesrc/jsql-neo-core/src/storage/wal.rs +85 -0
- package/nativesrc/jsql-neo-core/src/types.rs +94 -0
- package/nativesrc/jsql-neo-native/Cargo.lock +606 -0
- package/nativesrc/jsql-neo-native/Cargo.toml +16 -0
- package/nativesrc/jsql-neo-native/jsql-neo-native.node +0 -0
- package/nativesrc/jsql-neo-native/package.json +7 -0
- package/nativesrc/jsql-neo-native/src/lib.rs +281 -0
- package/package.json +9 -1
- package/wasm/jsql_neo_wasm.d.ts +8 -0
- package/wasm/jsql_neo_wasm.js +455 -6
- package/wasm/jsql_neo_wasm_bg.js +22 -0
- package/wasm/jsql_neo_wasm_bg.wasm +0 -0
- package/wasm/jsql_neo_wasm_bg.wasm.d.ts +4 -0
- package/wasm/package.json +1 -8
package/wasm/jsql_neo_wasm.js
CHANGED
|
@@ -1,9 +1,458 @@
|
|
|
1
1
|
/* @ts-self-types="./jsql_neo_wasm.d.ts" */
|
|
2
|
-
import * as wasm from "./jsql_neo_wasm_bg.wasm";
|
|
3
|
-
import { __wbg_set_wasm } from "./jsql_neo_wasm_bg.js";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} table
|
|
5
|
+
* @returns {string}
|
|
6
|
+
*/
|
|
7
|
+
function jsql_count(table) {
|
|
8
|
+
let deferred2_0;
|
|
9
|
+
let deferred2_1;
|
|
10
|
+
try {
|
|
11
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
12
|
+
const len0 = WASM_VECTOR_LEN;
|
|
13
|
+
const ret = wasm.jsql_count(ptr0, len0);
|
|
14
|
+
deferred2_0 = ret[0];
|
|
15
|
+
deferred2_1 = ret[1];
|
|
16
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
17
|
+
} finally {
|
|
18
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.jsql_count = jsql_count;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} name
|
|
25
|
+
* @param {string} schema_json
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
function jsql_create_table(name, schema_json) {
|
|
29
|
+
let deferred3_0;
|
|
30
|
+
let deferred3_1;
|
|
31
|
+
try {
|
|
32
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
33
|
+
const len0 = WASM_VECTOR_LEN;
|
|
34
|
+
const ptr1 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
|
+
const len1 = WASM_VECTOR_LEN;
|
|
36
|
+
const ret = wasm.jsql_create_table(ptr0, len0, ptr1, len1);
|
|
37
|
+
deferred3_0 = ret[0];
|
|
38
|
+
deferred3_1 = ret[1];
|
|
39
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
40
|
+
} finally {
|
|
41
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.jsql_create_table = jsql_create_table;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} name
|
|
48
|
+
* @returns {string}
|
|
49
|
+
*/
|
|
50
|
+
function jsql_drop_table(name) {
|
|
51
|
+
let deferred2_0;
|
|
52
|
+
let deferred2_1;
|
|
53
|
+
try {
|
|
54
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
55
|
+
const len0 = WASM_VECTOR_LEN;
|
|
56
|
+
const ret = wasm.jsql_drop_table(ptr0, len0);
|
|
57
|
+
deferred2_0 = ret[0];
|
|
58
|
+
deferred2_1 = ret[1];
|
|
59
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
60
|
+
} finally {
|
|
61
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.jsql_drop_table = jsql_drop_table;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} table
|
|
68
|
+
* @param {string} filter_json
|
|
69
|
+
* @param {number} limit
|
|
70
|
+
* @param {number} offset
|
|
71
|
+
* @returns {string}
|
|
72
|
+
*/
|
|
73
|
+
function jsql_find(table, filter_json, limit, offset) {
|
|
74
|
+
let deferred3_0;
|
|
75
|
+
let deferred3_1;
|
|
76
|
+
try {
|
|
77
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
78
|
+
const len0 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr1 = passStringToWasm0(filter_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
80
|
+
const len1 = WASM_VECTOR_LEN;
|
|
81
|
+
const ret = wasm.jsql_find(ptr0, len0, ptr1, len1, limit, offset);
|
|
82
|
+
deferred3_0 = ret[0];
|
|
83
|
+
deferred3_1 = ret[1];
|
|
84
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
85
|
+
} finally {
|
|
86
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.jsql_find = jsql_find;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {string} table
|
|
93
|
+
* @param {bigint} id
|
|
94
|
+
* @returns {string}
|
|
95
|
+
*/
|
|
96
|
+
function jsql_find_by_id(table, id) {
|
|
97
|
+
let deferred2_0;
|
|
98
|
+
let deferred2_1;
|
|
99
|
+
try {
|
|
100
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
101
|
+
const len0 = WASM_VECTOR_LEN;
|
|
102
|
+
const ret = wasm.jsql_find_by_id(ptr0, len0, id);
|
|
103
|
+
deferred2_0 = ret[0];
|
|
104
|
+
deferred2_1 = ret[1];
|
|
105
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
106
|
+
} finally {
|
|
107
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.jsql_find_by_id = jsql_find_by_id;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @param {string} table
|
|
114
|
+
* @param {string} ids_json
|
|
115
|
+
* @returns {string}
|
|
116
|
+
*/
|
|
117
|
+
function jsql_find_by_ids(table, ids_json) {
|
|
118
|
+
let deferred3_0;
|
|
119
|
+
let deferred3_1;
|
|
120
|
+
try {
|
|
121
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
122
|
+
const len0 = WASM_VECTOR_LEN;
|
|
123
|
+
const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
124
|
+
const len1 = WASM_VECTOR_LEN;
|
|
125
|
+
const ret = wasm.jsql_find_by_ids(ptr0, len0, ptr1, len1);
|
|
126
|
+
deferred3_0 = ret[0];
|
|
127
|
+
deferred3_1 = ret[1];
|
|
128
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
129
|
+
} finally {
|
|
130
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.jsql_find_by_ids = jsql_find_by_ids;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @param {string} table
|
|
137
|
+
* @param {string} data_json
|
|
138
|
+
* @returns {string}
|
|
139
|
+
*/
|
|
140
|
+
function jsql_insert(table, data_json) {
|
|
141
|
+
let deferred3_0;
|
|
142
|
+
let deferred3_1;
|
|
143
|
+
try {
|
|
144
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
|
+
const len0 = WASM_VECTOR_LEN;
|
|
146
|
+
const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
|
+
const len1 = WASM_VECTOR_LEN;
|
|
148
|
+
const ret = wasm.jsql_insert(ptr0, len0, ptr1, len1);
|
|
149
|
+
deferred3_0 = ret[0];
|
|
150
|
+
deferred3_1 = ret[1];
|
|
151
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
152
|
+
} finally {
|
|
153
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.jsql_insert = jsql_insert;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @param {string} table
|
|
160
|
+
* @param {Uint8Array} data
|
|
161
|
+
* @returns {string}
|
|
162
|
+
*/
|
|
163
|
+
function jsql_insert_buf(table, data) {
|
|
164
|
+
let deferred3_0;
|
|
165
|
+
let deferred3_1;
|
|
166
|
+
try {
|
|
167
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
168
|
+
const len0 = WASM_VECTOR_LEN;
|
|
169
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
170
|
+
const len1 = WASM_VECTOR_LEN;
|
|
171
|
+
const ret = wasm.jsql_insert_buf(ptr0, len0, ptr1, len1);
|
|
172
|
+
deferred3_0 = ret[0];
|
|
173
|
+
deferred3_1 = ret[1];
|
|
174
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
175
|
+
} finally {
|
|
176
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.jsql_insert_buf = jsql_insert_buf;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @param {string} table
|
|
183
|
+
* @param {Uint8Array} data
|
|
184
|
+
* @returns {string}
|
|
185
|
+
*/
|
|
186
|
+
function jsql_insert_buf_count(table, data) {
|
|
187
|
+
let deferred3_0;
|
|
188
|
+
let deferred3_1;
|
|
189
|
+
try {
|
|
190
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
191
|
+
const len0 = WASM_VECTOR_LEN;
|
|
192
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
193
|
+
const len1 = WASM_VECTOR_LEN;
|
|
194
|
+
const ret = wasm.jsql_insert_buf_count(ptr0, len0, ptr1, len1);
|
|
195
|
+
deferred3_0 = ret[0];
|
|
196
|
+
deferred3_1 = ret[1];
|
|
197
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
198
|
+
} finally {
|
|
199
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.jsql_insert_buf_count = jsql_insert_buf_count;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @param {string} table
|
|
206
|
+
* @param {string} json
|
|
207
|
+
* @returns {string}
|
|
208
|
+
*/
|
|
209
|
+
function jsql_insert_json(table, json) {
|
|
210
|
+
let deferred3_0;
|
|
211
|
+
let deferred3_1;
|
|
212
|
+
try {
|
|
213
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
214
|
+
const len0 = WASM_VECTOR_LEN;
|
|
215
|
+
const ptr1 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
216
|
+
const len1 = WASM_VECTOR_LEN;
|
|
217
|
+
const ret = wasm.jsql_insert_json(ptr0, len0, ptr1, len1);
|
|
218
|
+
deferred3_0 = ret[0];
|
|
219
|
+
deferred3_1 = ret[1];
|
|
220
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
221
|
+
} finally {
|
|
222
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
exports.jsql_insert_json = jsql_insert_json;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @param {string} table
|
|
229
|
+
* @param {bigint} id
|
|
230
|
+
* @returns {string}
|
|
231
|
+
*/
|
|
232
|
+
function jsql_remove_by_id(table, id) {
|
|
233
|
+
let deferred2_0;
|
|
234
|
+
let deferred2_1;
|
|
235
|
+
try {
|
|
236
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
|
+
const len0 = WASM_VECTOR_LEN;
|
|
238
|
+
const ret = wasm.jsql_remove_by_id(ptr0, len0, id);
|
|
239
|
+
deferred2_0 = ret[0];
|
|
240
|
+
deferred2_1 = ret[1];
|
|
241
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.jsql_remove_by_id = jsql_remove_by_id;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @param {string} table
|
|
250
|
+
* @param {string} ids_json
|
|
251
|
+
* @returns {string}
|
|
252
|
+
*/
|
|
253
|
+
function jsql_remove_by_ids(table, ids_json) {
|
|
254
|
+
let deferred3_0;
|
|
255
|
+
let deferred3_1;
|
|
256
|
+
try {
|
|
257
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ptr1 = passStringToWasm0(ids_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
260
|
+
const len1 = WASM_VECTOR_LEN;
|
|
261
|
+
const ret = wasm.jsql_remove_by_ids(ptr0, len0, ptr1, len1);
|
|
262
|
+
deferred3_0 = ret[0];
|
|
263
|
+
deferred3_1 = ret[1];
|
|
264
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
265
|
+
} finally {
|
|
266
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
exports.jsql_remove_by_ids = jsql_remove_by_ids;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @param {string} table
|
|
273
|
+
* @param {bigint} id
|
|
274
|
+
* @param {string} data_json
|
|
275
|
+
* @returns {string}
|
|
276
|
+
*/
|
|
277
|
+
function jsql_update_by_id(table, id, data_json) {
|
|
278
|
+
let deferred3_0;
|
|
279
|
+
let deferred3_1;
|
|
280
|
+
try {
|
|
281
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
282
|
+
const len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ptr1 = passStringToWasm0(data_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
+
const len1 = WASM_VECTOR_LEN;
|
|
285
|
+
const ret = wasm.jsql_update_by_id(ptr0, len0, id, ptr1, len1);
|
|
286
|
+
deferred3_0 = ret[0];
|
|
287
|
+
deferred3_1 = ret[1];
|
|
288
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
289
|
+
} finally {
|
|
290
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
exports.jsql_update_by_id = jsql_update_by_id;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @param {string} table
|
|
297
|
+
* @param {string} batch_json
|
|
298
|
+
* @returns {string}
|
|
299
|
+
*/
|
|
300
|
+
function jsql_update_by_ids(table, batch_json) {
|
|
301
|
+
let deferred3_0;
|
|
302
|
+
let deferred3_1;
|
|
303
|
+
try {
|
|
304
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
const ptr1 = passStringToWasm0(batch_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
307
|
+
const len1 = WASM_VECTOR_LEN;
|
|
308
|
+
const ret = wasm.jsql_update_by_ids(ptr0, len0, ptr1, len1);
|
|
309
|
+
deferred3_0 = ret[0];
|
|
310
|
+
deferred3_1 = ret[1];
|
|
311
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
312
|
+
} finally {
|
|
313
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
exports.jsql_update_by_ids = jsql_update_by_ids;
|
|
317
|
+
function __wbg_get_imports() {
|
|
318
|
+
const import0 = {
|
|
319
|
+
__proto__: null,
|
|
320
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
321
|
+
const obj = arg1;
|
|
322
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
323
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
324
|
+
var len1 = WASM_VECTOR_LEN;
|
|
325
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
326
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
327
|
+
},
|
|
328
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
329
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
330
|
+
},
|
|
331
|
+
__wbg_new_cc984128914cfc6f: function(arg0) {
|
|
332
|
+
const ret = new Date(arg0);
|
|
333
|
+
return ret;
|
|
334
|
+
},
|
|
335
|
+
__wbg_now_86c0d4ba3fa605b8: function() {
|
|
336
|
+
const ret = Date.now();
|
|
337
|
+
return ret;
|
|
338
|
+
},
|
|
339
|
+
__wbg_toISOString_706fbe321055ee58: function(arg0) {
|
|
340
|
+
const ret = arg0.toISOString();
|
|
341
|
+
return ret;
|
|
342
|
+
},
|
|
343
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
344
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
345
|
+
const ret = arg0;
|
|
346
|
+
return ret;
|
|
347
|
+
},
|
|
348
|
+
__wbindgen_init_externref_table: function() {
|
|
349
|
+
const table = wasm.__wbindgen_externrefs;
|
|
350
|
+
const offset = table.grow(4);
|
|
351
|
+
table.set(0, undefined);
|
|
352
|
+
table.set(offset + 0, undefined);
|
|
353
|
+
table.set(offset + 1, null);
|
|
354
|
+
table.set(offset + 2, true);
|
|
355
|
+
table.set(offset + 3, false);
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
return {
|
|
359
|
+
__proto__: null,
|
|
360
|
+
"./jsql_neo_wasm_bg.js": import0,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
let cachedDataViewMemory0 = null;
|
|
365
|
+
function getDataViewMemory0() {
|
|
366
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
367
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
368
|
+
}
|
|
369
|
+
return cachedDataViewMemory0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function getStringFromWasm0(ptr, len) {
|
|
373
|
+
return decodeText(ptr >>> 0, len);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let cachedUint8ArrayMemory0 = null;
|
|
377
|
+
function getUint8ArrayMemory0() {
|
|
378
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
379
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
380
|
+
}
|
|
381
|
+
return cachedUint8ArrayMemory0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function isLikeNone(x) {
|
|
385
|
+
return x === undefined || x === null;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
389
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
390
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
391
|
+
WASM_VECTOR_LEN = arg.length;
|
|
392
|
+
return ptr;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
396
|
+
if (realloc === undefined) {
|
|
397
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
398
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
399
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
400
|
+
WASM_VECTOR_LEN = buf.length;
|
|
401
|
+
return ptr;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
let len = arg.length;
|
|
405
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
406
|
+
|
|
407
|
+
const mem = getUint8ArrayMemory0();
|
|
408
|
+
|
|
409
|
+
let offset = 0;
|
|
410
|
+
|
|
411
|
+
for (; offset < len; offset++) {
|
|
412
|
+
const code = arg.charCodeAt(offset);
|
|
413
|
+
if (code > 0x7F) break;
|
|
414
|
+
mem[ptr + offset] = code;
|
|
415
|
+
}
|
|
416
|
+
if (offset !== len) {
|
|
417
|
+
if (offset !== 0) {
|
|
418
|
+
arg = arg.slice(offset);
|
|
419
|
+
}
|
|
420
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
421
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
422
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
423
|
+
|
|
424
|
+
offset += ret.written;
|
|
425
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
WASM_VECTOR_LEN = offset;
|
|
429
|
+
return ptr;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
433
|
+
cachedTextDecoder.decode();
|
|
434
|
+
function decodeText(ptr, len) {
|
|
435
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const cachedTextEncoder = new TextEncoder();
|
|
439
|
+
|
|
440
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
441
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
442
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
443
|
+
view.set(buf);
|
|
444
|
+
return {
|
|
445
|
+
read: arg.length,
|
|
446
|
+
written: buf.length
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
let WASM_VECTOR_LEN = 0;
|
|
452
|
+
|
|
453
|
+
const wasmPath = `${__dirname}/jsql_neo_wasm_bg.wasm`;
|
|
454
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
455
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
456
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
457
|
+
let wasm = wasmInstance.exports;
|
|
6
458
|
wasm.__wbindgen_start();
|
|
7
|
-
export {
|
|
8
|
-
jsql_count, jsql_create_table, jsql_drop_table, jsql_find, jsql_find_by_id, jsql_insert, jsql_insert_buf, jsql_insert_buf_count, jsql_remove_by_id, jsql_update_by_id
|
|
9
|
-
} from "./jsql_neo_wasm_bg.js";
|
package/wasm/jsql_neo_wasm_bg.js
CHANGED
|
@@ -168,6 +168,28 @@ export function jsql_insert_buf_count(table, data) {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* @param {string} table
|
|
173
|
+
* @param {string} json
|
|
174
|
+
* @returns {string}
|
|
175
|
+
*/
|
|
176
|
+
export function jsql_insert_json(table, json) {
|
|
177
|
+
let deferred3_0;
|
|
178
|
+
let deferred3_1;
|
|
179
|
+
try {
|
|
180
|
+
const ptr0 = passStringToWasm0(table, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
181
|
+
const len0 = WASM_VECTOR_LEN;
|
|
182
|
+
const ptr1 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
183
|
+
const len1 = WASM_VECTOR_LEN;
|
|
184
|
+
const ret = wasm.jsql_insert_json(ptr0, len0, ptr1, len1);
|
|
185
|
+
deferred3_0 = ret[0];
|
|
186
|
+
deferred3_1 = ret[1];
|
|
187
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
188
|
+
} finally {
|
|
189
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
171
193
|
/**
|
|
172
194
|
* @param {string} table
|
|
173
195
|
* @param {bigint} id
|
|
Binary file
|
|
@@ -6,11 +6,15 @@ export const jsql_create_table: (a: number, b: number, c: number, d: number) =>
|
|
|
6
6
|
export const jsql_drop_table: (a: number, b: number) => [number, number];
|
|
7
7
|
export const jsql_find: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
8
8
|
export const jsql_find_by_id: (a: number, b: number, c: bigint) => [number, number];
|
|
9
|
+
export const jsql_find_by_ids: (a: number, b: number, c: number, d: number) => [number, number];
|
|
9
10
|
export const jsql_insert: (a: number, b: number, c: number, d: number) => [number, number];
|
|
10
11
|
export const jsql_insert_buf: (a: number, b: number, c: number, d: number) => [number, number];
|
|
11
12
|
export const jsql_insert_buf_count: (a: number, b: number, c: number, d: number) => [number, number];
|
|
13
|
+
export const jsql_insert_json: (a: number, b: number, c: number, d: number) => [number, number];
|
|
12
14
|
export const jsql_remove_by_id: (a: number, b: number, c: bigint) => [number, number];
|
|
15
|
+
export const jsql_remove_by_ids: (a: number, b: number, c: number, d: number) => [number, number];
|
|
13
16
|
export const jsql_update_by_id: (a: number, b: number, c: bigint, d: number, e: number) => [number, number];
|
|
17
|
+
export const jsql_update_by_ids: (a: number, b: number, c: number, d: number) => [number, number];
|
|
14
18
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
15
19
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
16
20
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
package/wasm/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsql-neo-wasm",
|
|
3
|
-
"type": "module",
|
|
4
|
-
"description": "JSQL Neo WASM bindings",
|
|
5
3
|
"version": "0.1.0",
|
|
6
4
|
"files": [
|
|
7
5
|
"jsql_neo_wasm_bg.wasm",
|
|
8
6
|
"jsql_neo_wasm.js",
|
|
9
|
-
"jsql_neo_wasm_bg.js",
|
|
10
7
|
"jsql_neo_wasm.d.ts"
|
|
11
8
|
],
|
|
12
9
|
"main": "jsql_neo_wasm.js",
|
|
13
|
-
"types": "jsql_neo_wasm.d.ts"
|
|
14
|
-
"sideEffects": [
|
|
15
|
-
"./jsql_neo_wasm.js",
|
|
16
|
-
"./snippets/*"
|
|
17
|
-
]
|
|
10
|
+
"types": "jsql_neo_wasm.d.ts"
|
|
18
11
|
}
|