exemplar 0.5.2

A boilerplate eliminator for rusqlite.
Documentation

Features

  • Works with raw SQL, not against it. Exemplar is not an ORM.
  • Thin, zero-cost API.
    • Most of Exemplar revolves around the Model trait, which gets inlined and monomorphized away before runtime. The resulting code is roughly what you'd write by hand when using pure rusqlite.
    • Designed to be drop-in; reuses rusqlite's existing types where possible, including its Result type alias.
    • Supports any type that Deref's to rusqlite::Connection, such as transactions or pooled connections.
  • Optional test derivation for guarding against drift between your database schema and Rust model types.
  • Macros for working with SQL-compatible enums and "anonymous" record types that map to ad-hoc queries.

If you just need to CRUD some Rust data with sqlite and don't want a whole ORM or enterprise-grade DBMS, then Exemplar is for you!

Cargo Features

  • (Default) sql_enum - enables the sql_enum macro. Depends on num_enum.

Won't Support

  • Schema generation and management. It's very difficult to represent concepts like foreign keys and migrations without falling into ORM territory.
    • If this is a "must" for you, check out diesel or sqlx/seaorm.
  • Database interfaces besides rusqlite.
    • (I may extend support to sqlite if there is demand, but it's likely to be less performant as it lacks statement caching.)

Acknowledgements

  • rusqlite, for providing the foundation on which this library is built.
  • David Tolnay, for his various proc macro incantations crates.