Skip to content

Using named arguments in queries using the pg_named_args crate #1107

Open
@rudolphfroger

Description

@rudolphfroger

Hi,

Thanks for all the work on rust-postgres!

We've created a new crate which allows one to use named arguments on queries. This is achieved using a macro which rewrites the named arguments into positional arguments. This crate is specifically aimed at supporting rust-postgres because it outputs the query and array exactly as needed.

This crate happily lives on it's own, but it may be nice to point people towards the possibility of using named arguments in the tokio-postgres documentation. Would you be willing to add such a reference to your documentation and/or README?

The docs can be found at: https://docs.rs/pg_named_args/. This includes some examples on how to use it. We've been using this internally for some time, and it works great for us, especially once you have more than a few arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions