turbosql
turbosql copied to clipboard
An easy local data persistence layer for Rust, backed by SQLite.
re `directories-next`: https://github.com/xdg-rs/dirs/issues/60
the following example will not store the data correctly ```rs type StringType = String; type Number = i64; #[derive(Turbosql, Default)] struct Person { rowid: Option, name: Option, age: Option, image_jpg:...
See also https://phiresky.github.io/blog/2020/sqlite-performance-tuning/
Maybe in an mdbook? SQLite is more performant when many writes are batched in a single transaction. Need for explicit checkpointing for a larger, busy db.
Sort of like https://github.com/trevyn/turbosql/issues/27 but supporting the ability to tell turbosql that one of the struct properties should take the place of `rowid`, which can be used down the line...
Support for foreign keys for nested structs would support SQL JOINs and more complicated/efficient querying. Foreign key support would be an alternative to dumping nested structs to a field as...
With SQLite `INSERT OR REPLACE INTO` or ```rust execute!( "INSERT INTO node(host, id)" "VALUES (" host, node.id ")" "ON CONFLICT(host) DO UPDATE SET id = " node.id )?; ``` ```rust...
```rust if let Some(rowid) = select!(Option "WHERE ip = " ip)? { ``` vs ``` rust if let Some(_turbonet_peers { rowid, .. }) = select!(Option "WHERE ip = " ip)?...
```rust #[derive(Turbosql)] struct Config { // ... } Config::select_singleton(); Config{ .. }.upsert_singleton(); ```
Separate binary that can be run that uses `syn` to parse out `.rs` files, replace strings with SQL with pretty-printed, then run `rustfmt` afterwards. Can swap this in with `rust-analyzer.rustfmt.overrideCommand`....