In this chapter, we will continue to interact with databases, but this time we will explore object-relational mapping (ORM) using the diesel crate. This crate helps with generating Rust types that represent tables and records in SQL databases. ORM allows you to use native data structs in code and maps records and database tables to them. It's useful because the compiler takes care of matching types of data columns in a database and structs in source code.
After reading this chapter you will be familiar with the following:
- Using the diesel crate with r2d2 pools
- Generating and applying migrations
- Accessing data with ORM types