aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md29
1 files changed, 27 insertions, 2 deletions
diff --git a/README.md b/README.md
index 2f5b98ff..272d2dae 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,32 @@ npm install
# terminal 1 (UI localhost for hot-reload)
npm run ui-dev
-# terminal 2 (for the Tauri ho)
-npm
+# terminal 2 (for the Rust/App hot-reload)
+npm run tauri dev
```
+## Database Pool as state
+
+Rather to have a simple Mutex for the state, database can be used.
+
+```
+sqlx = { version = "0.6", features = [ "runtime-tokio-rustls", "postgres" ] }
+```
+
+```rs
+let con_string = format!("postgres://postgres:postgres@localhost/postgres");
+let db = PgPoolOptions::new()
+ .max_connections(5)
+ .connect(&con_string)
+ .await
+ .expect("Cannot create PgPool");
+
+let arc_db = Arc::new(db);
+```
+
+Then
+
+```rs
+tauri::Builder::default()
+ .manage(arc_db)
+``` \ No newline at end of file