Skip to content
forked from prisma/quaint

SQL Query AST and Visitor for Rust

License

Notifications You must be signed in to change notification settings

efugulin/quaint

This branch is 124 commits behind prisma/quaint:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

8196f13 · Apr 8, 2021
Apr 7, 2021
Jun 11, 2019
Apr 8, 2021
Nov 23, 2020
Feb 10, 2021
Mar 12, 2021
Mar 12, 2021
Feb 25, 2021
Feb 22, 2019
Mar 30, 2021
Feb 22, 2019
Mar 30, 2021
Mar 25, 2021
Mar 30, 2021
Mar 24, 2020
Mar 12, 2021

Quaint

crates.io docs.rs Cargo tests Discord

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

  • mysql: Support for MySQL databases.
  • postgresql: Support for PostgreSQL databases.
  • sqlite: Support for SQLite databases.
  • mssql: Support for Microsoft SQL Server databases.
  • pooled: A connection pool in pooled::Quaint.
  • json: JSON type support with serde_json crate.
  • uuid: UUID type support with uuid crate.
  • chrono: DateTime type support with chrono crate.
  • serde-support: Deserialize support from result set with serde crate.
  • bigdecimal: Numeric values can be read as BigDecimal.
  • vendored-openssl: Statically links against a vendored OpenSSL library on non-Windows or non-Apple platforms.

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 .envrc for 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.

Security

If you have a security issue to report, please contact us at security@prisma.io

About

SQL Query AST and Visitor for Rust

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 100.0%