Quaint
Quaint is an abstraction over certain SQL databases. It provides:
- An AST for building dynamic SQL queries.
- Visitors for different databases to generate SQL strings.
- Connectors to abstract over results and querying.
- Pooling with mobc
- Async/await and Futures 0.3
Documentation
Feature flags
full: All connectors and a pooledQuaintmanagerfull-postgresql: Pooled support for PostgreSQLfull-mysql: Pooled support for MySQLfull-sqlite: Pooled support for SQLitesingle: All connectors, but no poolingsingle-postgresql: Single connection support for PostgreSQLsingle-mysql: Single connection support for MySQLsingle-sqlite: Single connection support for SQLite
Goals:
- Query generation when the database and conditions are not known beforehand.
- Parameterized queries and SQL injection protection.
- A modular design, a separate AST and separate visitors and connectors.
Non-goals:
- Database-level type-safety in query building or being an ORM.
For type-safe database abstraction, Diesel is an excellent choice.
Testing:
- See
.envrcfor connection params. Override variables if different. MySQL and PostgreSQL needs to be running for tests to succeed.
Then:
> cargo
Query debug
The queries can be logged by setting the LOG_QUERIES environment variable to any
value. They'll be logged at the INFO level and are visible when having a
logger in scope. If using Tracing,
compiling Quaint with the tracing-log feature flag will parameterize the
logged queries into a more suitable format for Tracing.