List Resource
Learn to create a method to show a list of items from the database.
We'll cover the following...
List products
We add the models.rs
file for our models in the src
folder with the products model.
Note: Find more information about the file structure in the Set Up Diesel lesson.
Press + to interact
use serde::{Serialize, Deserialize};use diesel::Queryable;#[derive(Queryable, Debug, Serialize, Deserialize)]pub struct Product {pub id: i32,pub name: String,pub cost: f64,pub active: bool,}
The first model, Product
...