Skip to content

SQLx 0.6.0 Release Tracking Issue #1413

Closed
@abonander

Description

@abonander

Our SQLx-Next initiative (#1163) has been pushed back to 0.7.0 as we wait for Generic Associated Types to be stabilized, as GATs will make it possible to do a lot of cleanup in the API.

In the meantime, we've decided to backport a handful of features we're really excited for, as well as merge in some feature work from contributors that has been in the pipeline for a while.

Backport

Database-agnostic syntax for bind parameters, providing named parameters and comma-expansion for arrays.

Additionally, the query!() family of macros will support implicit bindings from scope like that proposed for format_args! in RFC #2795:

let bars = vec!["bar1", "bar2", "bar3"];
let baz = 1i32;

sqlx::query!("UPDATE foo SET baz = {baz} WHERE bar IN ({bars+})")
    .execute(&mut conn)
    .await?;
sqlx::query("INSERT INTO foo(bar, baz) VALUES (%bar, %baz)")
    .bind_as("bar", &bar)
    .bind_as("baz", &baz)

Contributions

Eliminates dealing with constant merge conflicts in sqlx-data.json with multiple people contributing to the same repository.

The macros will be able to save their data automatically which means you shouldn't need to remember cargo sqlx prepare as long as you've built the project at least once after adding or changing a macro definition.

Compiling in offline mode should be faster as projects with many query!() invocations won't need to repeatedly re-parse the same gigantic file. This would be further improved by using a binary file format supporting zero-copy parsing, like Cap'N'Proto.

The PR currently open (#1345) implements a basic low-level API which we can build on later with a strongly typed interface. Still, if you're looking to shove a giant CSV file into your database, this would be the place to start.

This should finally allow use of Vec<T> where T is a custom type with #[derive(sqlx::Type)].

Misc

We will probably need to retain support for time 0.2 under a time-02 feature for at least the next couple releases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions