@tauri-apps/plugin-sql 2.0.0-alpha.2 → 2.0.0-alpha.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.
- package/README.md +16 -0
- package/dist-js/{index.min.js → index.cjs} +9 -10
- package/dist-js/{index.mjs → index.js} +2 -3
- package/package.json +7 -11
package/README.md
CHANGED
|
@@ -109,6 +109,22 @@ const result = await db.execute(
|
|
|
109
109
|
|
|
110
110
|
PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
|
|
111
111
|
|
|
112
|
+
## Partners
|
|
113
|
+
|
|
114
|
+
<table>
|
|
115
|
+
<tbody>
|
|
116
|
+
<tr>
|
|
117
|
+
<td align="center" valign="middle">
|
|
118
|
+
<a href="https://crabnebula.dev" target="_blank">
|
|
119
|
+
<img src="https://github.com/tauri-apps/plugins-workspace/raw/v2/.github/sponsors/crabnebula.svg" alt="CrabNebula" width="283">
|
|
120
|
+
</a>
|
|
121
|
+
</td>
|
|
122
|
+
</tr>
|
|
123
|
+
</tbody>
|
|
124
|
+
</table>
|
|
125
|
+
|
|
126
|
+
For the complete list of sponsors please visit our [website](https://tauri.app#sponsors) and [Open Collective](https://opencollective.com/tauri).
|
|
127
|
+
|
|
112
128
|
## License
|
|
113
129
|
|
|
114
130
|
Code: (c) 2015 - Present - The Tauri Programme within The Commons Conservancy.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var primitives = require('@tauri-apps/api/primitives');
|
|
4
4
|
|
|
5
5
|
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
6
6
|
// SPDX-License-Identifier: Apache-2.0
|
|
@@ -31,7 +31,7 @@ class Database {
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
static async load(path) {
|
|
34
|
-
const _path = await
|
|
34
|
+
const _path = await primitives.invoke("plugin:sql|load", {
|
|
35
35
|
db: path,
|
|
36
36
|
});
|
|
37
37
|
return new Database(_path);
|
|
@@ -88,10 +88,10 @@ class Database {
|
|
|
88
88
|
* ```
|
|
89
89
|
*/
|
|
90
90
|
async execute(query, bindValues) {
|
|
91
|
-
const [rowsAffected, lastInsertId] = await
|
|
91
|
+
const [rowsAffected, lastInsertId] = await primitives.invoke("plugin:sql|execute", {
|
|
92
92
|
db: this.path,
|
|
93
93
|
query,
|
|
94
|
-
values: bindValues
|
|
94
|
+
values: bindValues ?? [],
|
|
95
95
|
});
|
|
96
96
|
return {
|
|
97
97
|
lastInsertId,
|
|
@@ -117,10 +117,10 @@ class Database {
|
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
async select(query, bindValues) {
|
|
120
|
-
const result = await
|
|
120
|
+
const result = await primitives.invoke("plugin:sql|select", {
|
|
121
121
|
db: this.path,
|
|
122
122
|
query,
|
|
123
|
-
values: bindValues
|
|
123
|
+
values: bindValues ?? [],
|
|
124
124
|
});
|
|
125
125
|
return result;
|
|
126
126
|
}
|
|
@@ -136,12 +136,11 @@ class Database {
|
|
|
136
136
|
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
|
|
137
137
|
*/
|
|
138
138
|
async close(db) {
|
|
139
|
-
const success = await
|
|
139
|
+
const success = await primitives.invoke("plugin:sql|close", {
|
|
140
140
|
db,
|
|
141
141
|
});
|
|
142
142
|
return success;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
//# sourceMappingURL=index.min.js.map
|
|
146
|
+
module.exports = Database;
|
|
@@ -89,7 +89,7 @@ class Database {
|
|
|
89
89
|
const [rowsAffected, lastInsertId] = await invoke("plugin:sql|execute", {
|
|
90
90
|
db: this.path,
|
|
91
91
|
query,
|
|
92
|
-
values: bindValues
|
|
92
|
+
values: bindValues ?? [],
|
|
93
93
|
});
|
|
94
94
|
return {
|
|
95
95
|
lastInsertId,
|
|
@@ -118,7 +118,7 @@ class Database {
|
|
|
118
118
|
const result = await invoke("plugin:sql|select", {
|
|
119
119
|
db: this.path,
|
|
120
120
|
query,
|
|
121
|
-
values: bindValues
|
|
121
|
+
values: bindValues ?? [],
|
|
122
122
|
});
|
|
123
123
|
return result;
|
|
124
124
|
}
|
|
@@ -142,4 +142,3 @@ class Database {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
export { Database as default };
|
|
145
|
-
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-sql",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"description": "Interface with SQL databases",
|
|
5
5
|
"license": "MIT or APACHE-2.0",
|
|
6
6
|
"authors": [
|
|
7
7
|
"Tauri Programme within The Commons Conservancy"
|
|
8
8
|
],
|
|
9
9
|
"type": "module",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"types": "./dist-js/index.d.ts",
|
|
11
|
+
"main": "./dist-js/index.cjs",
|
|
12
|
+
"module": "./dist-js/index.js",
|
|
13
13
|
"exports": {
|
|
14
|
-
"import": "./dist-js/index.mjs",
|
|
15
14
|
"types": "./dist-js/index.d.ts",
|
|
16
|
-
"
|
|
15
|
+
"import": "./dist-js/index.js",
|
|
16
|
+
"require": "./dist-js/index.cjs"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist-js",
|
|
20
|
-
"!dist-js/**/*.map",
|
|
21
20
|
"README.md",
|
|
22
21
|
"LICENSE"
|
|
23
22
|
],
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"tslib": "2.6.0"
|
|
26
|
-
},
|
|
27
23
|
"dependencies": {
|
|
28
|
-
"@tauri-apps/api": "2.0.0-alpha.
|
|
24
|
+
"@tauri-apps/api": "2.0.0-alpha.12"
|
|
29
25
|
},
|
|
30
26
|
"scripts": {
|
|
31
27
|
"build": "rollup -c"
|