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

Is there support for producing sql with numbered bind parameters or producing a values object with named bind parameters? #659

Open
anthonyorona opened this issue Dec 11, 2024 · 0 comments
Labels

Comments

@anthonyorona
Copy link

I am migrating to Slonik and use it for query building. I am constrained to use the Sequelize query interface as my DB client.

const { sql, values } = sql.type(MyZodType)`<SELECT QUERY>`;

In order to use bind parameters with the Sequelize query interface I have 2 options:

A) Find and replace '$slonik_' in the sql query string to create numbered bind parameters
B) produce an object from values array { slonik_1: , slonik_2: }

see: https://sequelize.org/docs/v6/core-concepts/raw-queries/#bind-parameter

I would prefer to have the shape I need returned from the library call instead of having to alter the output.

Given that this is part of migration to Sequelize, has anyone faced this issue before and if so, what was your solution? Perhaps I am missing an option or API call that I should be making in place of sql.type(MyZodType)

@anthonyorona anthonyorona changed the title Is there support for producing queries with numbered bind parameters or producing an object with named bind parameters? Is there support for producing sql with numbered bind parameters or producing a values object with named bind parameters? Dec 11, 2024
@gajus gajus added the question label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants