27 releases
| 0.2.0-alpha.13 | Jun 16, 2020 |
|---|---|
| 0.2.0-alpha.12 | May 20, 2020 |
| 0.2.0-alpha.11 | Mar 26, 2020 |
| 0.2.0-alpha.9 | Feb 28, 2020 |
| 0.1.4 | Dec 30, 2019 |
#364 in #mysql
189 downloads per month
555KB
12K
SLoC
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 SQLitefull-mssql: Pooled support for Microsoft SQL Serversingle: All connectors, but no poolingsingle-postgresql: Single connection support for PostgreSQLsingle-mysql: Single connection support for MySQLsingle-sqlite: Single connection support for SQLitesingle-mssql: Single connection support for Microsoft SQL Server
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, PostgreSQL and SQL Server needs to be running for tests to succeed.
Then:
> cargo test
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.
Dependencies
~4–22MB
~393K SLoC