chore: adjust prettier config, .gitignore and use taplo to format toml files (#1728)

* chore: adjust prettier config, .gitignore and use taplo to format toml files

This brings the plugins-workspace repository to the same code style of the main tauri repo

* format toml

* ignore examples gen dir

* add .vscode/extensions.json

* remove packageManager field

* fmt

* fix audit

* taplo ignore permissions autogenerated files

* remove create dummy dist

* fix prettier workflow

* install fmt in prettier workflow

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
Amr Bashir
2024-09-04 14:54:23 +03:00
committed by GitHub
parent 72c2ce82c1
commit cf4d7d4e6c
227 changed files with 2534 additions and 2505 deletions
+24 -24
View File
@@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { invoke } from "@tauri-apps/api/core";
import { invoke } from '@tauri-apps/api/core'
export interface QueryResult {
/** The number of rows affected by the query. */
rowsAffected: number;
rowsAffected: number
/**
* The last inserted `id`.
*
@@ -15,7 +15,7 @@ export interface QueryResult {
* must be used, with a `RETURNING` clause
* (`INSERT INTO todos (title) VALUES ($1) RETURNING id`).
*/
lastInsertId: number;
lastInsertId: number
}
/**
@@ -25,9 +25,9 @@ export interface QueryResult {
* communicating with the rust side of the sql plugin.
*/
export default class Database {
path: string;
path: string
constructor(path: string) {
this.path = path;
this.path = path
}
/**
@@ -46,11 +46,11 @@ export default class Database {
* ```
*/
static async load(path: string): Promise<Database> {
const _path = await invoke<string>("plugin:sql|load", {
db: path,
});
const _path = await invoke<string>('plugin:sql|load', {
db: path
})
return new Database(_path);
return new Database(_path)
}
/**
@@ -70,7 +70,7 @@ export default class Database {
* ```
*/
static get(path: string): Database {
return new Database(path);
return new Database(path)
}
/**
@@ -107,17 +107,17 @@ export default class Database {
*/
async execute(query: string, bindValues?: unknown[]): Promise<QueryResult> {
const [rowsAffected, lastInsertId] = await invoke<[number, number]>(
"plugin:sql|execute",
'plugin:sql|execute',
{
db: this.path,
query,
values: bindValues ?? [],
},
);
values: bindValues ?? []
}
)
return {
lastInsertId,
rowsAffected,
};
rowsAffected
}
}
/**
@@ -139,13 +139,13 @@ export default class Database {
* ```
*/
async select<T>(query: string, bindValues?: unknown[]): Promise<T> {
const result = await invoke<T>("plugin:sql|select", {
const result = await invoke<T>('plugin:sql|select', {
db: this.path,
query,
values: bindValues ?? [],
});
values: bindValues ?? []
})
return result;
return result
}
/**
@@ -160,9 +160,9 @@ export default class Database {
* @param db - Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope.
*/
async close(db?: string): Promise<boolean> {
const success = await invoke<boolean>("plugin:sql|close", {
db,
});
return success;
const success = await invoke<boolean>('plugin:sql|close', {
db
})
return success
}
}