Postgres and the diesel ORM

Writing a complex application using low-level database libraries with raw SQL queries is a recipe for a lot of mistakes. Diesel is an ORM (Object Relational Mapper) and a query builder for Rust. It makes heavy use of procedural macros. It detects most database interaction errors at compile time and is able to produce very efficient code in most cases, sometimes even beating low-level access with C. This is due to its ability to move checks that are typically made at runtime to compile time. At the time of writing, diesel supports PostgreSQL, MySQL, and SQLite out of the box.

We'll be integrating database support to the linksnap server that we developed in Chapter 13, Building Web Applications with Rust. We're going ...

Get Mastering Rust - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.