We want a slightly more ergonomic API than what rusqlite provides. This issue is for designing a solid baseline for this API such that we can "fall into the pit of success" when using it.
Some basic examples:
- We should never interact with raw Connections, only transactions.
- Statements should always be cached.
- We should distinguish between read and write transactions at the TYPE level.
The direction I would suggest is along the lines:
- Create tx and connection wrappers, never expose
rusqlite directly.
- Create a read and write trait for reading/writing a single column
- e.g.
impl ToSql for AccountId + impl FromSql for AccountId
- This is the database codec for our types
For improved ergonomics I would also suggest wrapping/extending the SQLite Row so that one can do things like:
We want a slightly more ergonomic API than what
rusqliteprovides. This issue is for designing a solid baseline for this API such that we can "fall into the pit of success" when using it.Some basic examples:
The direction I would suggest is along the lines:
rusqlitedirectly.impl ToSql for AccountId+impl FromSql for AccountIdFor improved ergonomics I would also suggest wrapping/extending the SQLite
Rowso that one can do things like: