trevyn / turbosql

An easy local data persistence layer for Rust, backed by SQLite.
204 stars 8 forks source link

Stricter typechecking #14

Open trevyn opened 3 years ago

trevyn commented 3 years ago

SQLite is flexibly typed, a philosophy which doesn't harmonize well with Rust's preference for strong types.

Despite this flexible typing, SQLite provides access to the underlying type of result columns of individual rows, and rusqlite exposes this via, for example:

These can be used to enforce additional typechecking at runtime, instead of the usual behavior of coercing types.

trevyn commented 2 years ago

Also incoming soon: SQLite STRICT tables:

https://www.sqlite.org/draft/stricttables.html

Doesn't directly support BOOLEAN, but other than that pretty nice. Note that derived columns should still be runtime typechecked!