12 lines
310 B
Rust
Raw Normal View History

use sqlx::PgPool;
pub struct PostsDatasource;
impl PostsDatasource {
pub async fn get_all(pool: PgPool) {
sqlx::query("SELECT title, body, created_at FROM posts ORDER BY created_at DESC LIMIT 10")
.fetch_all(&pool)
.await;
}
pub async fn get_one(pool: PgPool) {}
}