Last active: 10 months ago
sqlx query builder insert many
pub async fn record_post(urls: Vec<String>) -> Result<()> {
let pool = access_db().await;
let mut query_builder: QueryBuilder<Postgres> =
QueryBuilder::new("INSERT INTO post_record (url) ");
query_builder.push_values(urls, |mut b, url| {
b.push_bind(url);
});
let query = query_builder.build();
query.execute(pool).await?;
Ok(())
}