Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v1' into v2-merge-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars committed Jul 19, 2023
2 parents f5fbd80 + 0863f80 commit 753cfe5
Show file tree
Hide file tree
Showing 21 changed files with 1,104 additions and 1,141 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,28 @@
"format-check": "prettier --check ."
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.1",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@rollup/plugin-node-resolve": "15.1.0",
"@rollup/plugin-terser": "0.4.3",
"@rollup/plugin-typescript": "11.1.2",
"@typescript-eslint/eslint-plugin": "6.1.0",
"@typescript-eslint/parser": "6.1.0",
"covector": "^0.9.0",
"eslint": "^8.43.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-standard-with-typescript": "^36.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-security": "^1.7.1",
"prettier": "^3.0.0",
"rollup": "^3.25.1",
"typescript": "^5.1.3"
"eslint": "8.45.0",
"eslint-config-prettier": "8.8.0",
"eslint-config-standard-with-typescript": "36.1.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-n": "16.0.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-security": "1.7.1",
"prettier": "3.0.0",
"rollup": "3.26.3",
"typescript": "5.1.6"
},
"resolutions": {
"semver": ">=7.5.2"
"semver": ">=7.5.2",
"optionator": ">=0.9.3"
},
"engines": {
"pnpm": ">=7.33.0"
"pnpm": ">=7.33.1"
}
}
2 changes: 1 addition & 1 deletion plugins/authenticator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/autostart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/log/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/os/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/positioner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/process/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
106 changes: 0 additions & 106 deletions plugins/single-instance/examples/vanilla/pnpm-lock.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions plugins/sql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,37 @@ const db = await Database.load("postgres://postgres:password@localhost/test");
await db.execute("INSERT INTO ...");
```

## Syntax

We use sqlx as our underlying library, adopting their query syntax:

- sqlite and postgres use the "$#" syntax when substituting query data
- mysql uses "?" when substituting query data

```javascript
// INSERT and UPDATE examples for sqlite and postgres
const result = await db.execute(
"INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
[todos.id, todos.title, todos.status],
);

const result = await db.execute(
"UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
[todos.title, todos.status, todos.id],
);

// INSERT and UPDATE examples for mysql
const result = await db.execute(
"INSERT into todos (id, title, status) VALUES (?, ?, ?)",
[todos.id, todos.title, todos.status],
);

const result = await db.execute(
"UPDATE todos SET title = ?, completed = ? WHERE id = ?",
[todos.title, todos.status, todos.id],
);
```

## Contributing

PRs accepted. Please make sure to read the Contributing Guide before making a pull request.
Expand Down
26 changes: 25 additions & 1 deletion plugins/sql/guest-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,29 @@ export default class Database {
*
* @example
* ```ts
* // for sqlite & postgres
* // INSERT example
* const result = await db.execute(
* "INSERT into todos (id, title, status) VALUES ($1, $2, $3)",
* [ todos.id, todos.title, todos.status ]
* );
* // UPDATE example
* const result = await db.execute(
* "UPDATE todos SET title = $1, completed = $2 WHERE id = $3",
* [ todos.title, todos.status, todos.id ]
* );
*
* // for mysql
* // INSERT example
* const result = await db.execute(
* "INSERT into todos (id, title, status) VALUES (?, ?, ?)",
* [ todos.id, todos.title, todos.status ]
* );
* // UPDATE example
* const result = await db.execute(
* "UPDATE todos SET title = ?, completed = ? WHERE id = ?",
* [ todos.title, todos.status, todos.id ]
* );
* ```
*/
async execute(query: string, bindValues?: unknown[]): Promise<QueryResult> {
Expand All @@ -104,17 +123,22 @@ export default class Database {
rowsAffected,
};
}

/**
* **select**
*
* Passes in a SELECT query to the database for execution.
*
* @example
* ```ts
* // for sqlite & postgres
* const result = await db.select(
* "SELECT * from todos WHERE id = $1", id
* );
*
* // for mysql
* const result = await db.select(
* "SELECT * from todos WHERE id = ?", id
* );
* ```
*/
async select<T>(query: string, bindValues?: unknown[]): Promise<T> {
Expand Down
2 changes: 1 addition & 1 deletion plugins/sql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/stronghold/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tauri = { workspace = true }
log = { workspace = true }
thiserror = { workspace = true }
iota_stronghold = "1"
iota-crypto = "0.21"
iota-crypto = "0.23"
hex = "0.4"
zeroize = { version = "1", features = [ "zeroize_derive" ] }

Expand Down
2 changes: 1 addition & 1 deletion plugins/stronghold/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
2 changes: 1 addition & 1 deletion plugins/upload/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
14 changes: 7 additions & 7 deletions plugins/websocket/examples/svelte-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"tauri": "tauri"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^2.1.0",
"@sveltejs/kit": "^1.22.0",
"@sveltejs/adapter-auto": "2.1.0",
"@sveltejs/kit": "1.22.3",
"@tauri-apps/cli": "2.0.0-alpha.10",
"svelte": "^4.0.4",
"svelte-check": "^3.4.4",
"tslib": "^2.6.0",
"typescript": "^5.1.6",
"vite": "^4.4.0"
"svelte": "4.0.5",
"svelte-check": "3.4.6",
"tslib": "2.6.0",
"typescript": "5.1.6",
"vite": "4.4.4"
},
"dependencies": {
"@tauri-apps/plugin-websocket": "link:../../"
Expand Down
2 changes: 1 addition & 1 deletion plugins/websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"LICENSE"
],
"devDependencies": {
"tslib": "^2.5.0"
"tslib": "2.6.0"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-alpha.5"
Expand Down
Loading

0 comments on commit 753cfe5

Please sign in to comment.