This tag should be used for questions related to the diesel Rust ORM.
Diesel is an object relational mapper written in Rust. Diesel makes it easy to interact with SQL databases such as PostgreSQL and SQLite in a type-safe way.
Producing a Minimal, Reproducible Example (MRE) for Diesel
All of the general rules for a MRE apply, as do those for creating a Rust-specific MRE (see "Producing a Minimal, Reproducible Example (MRE) for Rust code").
You should include information like:
- What database system you are using (e.g. Postgres, MySQL, SQLite, etc.)
- Your schema definition(s)
- Your model definition(s)
You can combine all of your code into a single file, like this:
#[macro_use]
extern crate diesel;
mod schema {
table! {
users (user_id) {
user_id -> Int4,
email -> Text,
}
}
#[derive(Debug, Identifiable)]
#[primary_key(email)]
pub struct User {
pub user_id: i32,
pub email: String,
}
}
fn main() {}