Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dax-dot-gay/tauri-plugin-polodb
A Tauri plugin to expose the PoloDB embedded database to applications
https://github.com/dax-dot-gay/tauri-plugin-polodb
Last synced: 18 days ago
JSON representation
A Tauri plugin to expose the PoloDB embedded database to applications
- Host: GitHub
- URL: https://github.com/dax-dot-gay/tauri-plugin-polodb
- Owner: dax-dot-gay
- License: mit
- Created: 2024-09-02T17:23:21.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-05T20:12:33.000Z (2 months ago)
- Last Synced: 2024-10-14T00:29:45.343Z (about 1 month ago)
- Language: Rust
- Size: 592 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tauri-plugin-polodb
A Tauri plugin to expose the PoloDB embedded database to applications## Installation
To install the Rust plugin, run:
```bash
cargo add tauri-plugin-polodb
```Then, load the plugin in your Tauri app as follows:
```rust
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_polodb::init()) // THIS LINE
// More builder methods
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
```Finally, install the JS client bindings:
```bash
yarn add tauri-plugin-polodb-api
```## Usage
In the Rust backend, all the PoloDB APIs can be accessed through the `AppHandle` as follows:
```rust
...
app.polodb().
...
```On the client:
```typescript
import {Database} from "tauri-plugin-polodb-api";const db = await Database.open("example", "./data"); // Open a database
const collection = db.collection<{[key: string]: any}>("example_collection"); // Get a reference to a collection
console.log(await collection.find_all()); // Returns all records in the collection
```For query syntax, reference the PoloDB documentation.