Skip to content

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

Open
@anthonyorona

Description

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)

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions