use serde::Serialize; use sqlx::{FromRow, SqlitePool}; #[derive(FromRow, Serialize, Clone)] pub struct Role { id: i64, name: String, } impl Role { pub async fn all(db: &SqlitePool) -> Vec { sqlx::query_as!(Role, "SELECT id, name FROM role") .fetch_all(db) .await .unwrap() } }