![]() ![]() Being native Rust, SQLx will compile anywhere Rust is supported.īuilt-in connection pooling with sqlx::Pool. As the SQLite driver interacts with C, those interactions are unsafe.Ĭross-platform. SQLx uses #! unless the SQLite feature is enabled. The SQLite driver uses the libsqlite3 C library as SQLite is an embedded database (the only way we could be pure Rust for SQLite is by porting all of SQLite to Rust). Works on different runtimes (async-std / tokio / actix) and TLS backends (native-tls, rustls). The Postgres and MySQL/MariaDB drivers are written in pure Rust using zero unsafe code. Support for PostgreSQL, MySQL, SQLite, and MSSQL. See SQLx is not an ORM.ĭatabase Agnostic. Built from the ground up using async/await for maximum concurrency.Ĭompile-time checked queries (if you want). SQLx is an async, pure Rust SQL crate featuring compile-time checked queries without a DSL. It also enables you to share middleware with applications written using hyper or tonic. This means axum gets timeouts, tracing, compression, authorization, and more, for free. axum doesn't have its own middleware system but instead uses tower::Service. In particular the last point is what sets axum apart from other frameworks. Take full advantage of the tower and tower-http ecosystem of middleware, services, and utilities. ![]() Generate responses with minimal boilerplate. Simple and predictable error handling model. Route requests to handlers with a macro-free API.ĭeclaratively parse requests using extractors. If you don't know what Axum is, here is what its page says:Īxum is a web application framework that focuses on ergonomics and modularity. In this article, we will build a little REST API with Axum and Sqlx for the database. In this article, we are going to build a REST API using Axum as a web framework and Sqlx for SQL queries. I started to use Axum a few weeks ago, honestly, I'm a fan of the framework, so I'm writing this article to document my learning. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |