use super::{PgPool, Uuid}; /// Insert a link preview for a post. Ignores duplicates. #[tracing::instrument(skip_all)] pub async fn insert_link_preview( pool: &PgPool, post_id: Uuid, url: &str, title: Option<&str>, description: Option<&str>, ) -> Result<(), sqlx::Error> { sqlx::query!( "INSERT INTO link_previews (post_id, url, title, description) VALUES ($1, $2, $3, $4) ON CONFLICT (post_id, url) DO NOTHING", post_id, url, title, description, ) .execute(pool) .await?; Ok(()) }