launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
13.5k stars 1.28k forks source link

PgArguments::add returns a BoxDynError #3563

Open csandven opened 1 month ago

csandven commented 1 month ago

Bug Description

The add function returns a BoxDynError which means all functions that return a sqlx::Error type will manually need to map_err to the Encode error.

Minimal Reproduction

A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.

pub async fn store_data(
  connection: &mut PgConnection,
  content: MyData,
) -> Result<Metadata, sqlx::Error> {
  let mut arguments = PgArguments::default();
  arguments
    .add(i64::from(content.id))
    .map_err(sqlx::Error::Encode)?;

  // do query
}

Info