Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using named arguments in queries using the pg_named_args crate #1107

Open
rudolphfroger opened this issue Feb 28, 2024 · 1 comment · May be fixed by #1115
Open

Using named arguments in queries using the pg_named_args crate #1107

rudolphfroger opened this issue Feb 28, 2024 · 1 comment · May be fixed by #1115

Comments

@rudolphfroger
Copy link

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.

@sfackler
Copy link
Owner

Neat! Sure, it seems reasonable to link to it in the crate docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants