Skip to content

SQLite: Design framework #2248

@Mirko-von-Leipzig

Description

@Mirko-von-Leipzig

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:

row.get::<AccountId>(0)

Metadata

Metadata

Labels

No labels
No labels
No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions