Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/champii/reactive-postgres-rs
Reactive layer over PostgreSQL in Rust
https://github.com/champii/reactive-postgres-rs
Last synced: 4 days ago
JSON representation
Reactive layer over PostgreSQL in Rust
- Host: GitHub
- URL: https://github.com/champii/reactive-postgres-rs
- Owner: Champii
- Created: 2022-10-25T01:50:11.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T13:04:28.000Z (almost 2 years ago)
- Last Synced: 2024-12-14T16:38:33.476Z (8 days ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reactive PostgreSQL for Rust
Watch your queries results change as new rows are inserted/updated/deleted
Work in progress
This little example connects to localhost as user postgres. This will be configurable.
```rust
use reactive_pg::*;
use serde::{Deserialize, Serialize};#[derive(Serialize, Deserialize, Debug)]
struct Foo {
id: i32,
name: String,
}#[tokio::main]
async fn main() {
"SELECT * from foo where id < 10"
.watch::(|event| println!("{:#?}", event))
.await
.await // <- The second await will block until the connection is dropped
.unwrap();
}
```