You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
support passing bind parameters directly in Sequelize.literal() #14297
Literals are things we see the community try to avoid at all costs. Unfortunately, The Sequelize team is not able to implement each and every feature request due to time constraints.
This goal of this RFC is to propose new literal-based APIs to improve their Developer Experience.
This is fine most of the time, but it makes reusing part of a query complicated. You can't just do this:
functionisId(id){// where do I pass the value of the ID?returnliteral(`id = $id`);}User.findAll({where: isId(123),})
Solution
We can solve this easily by making literal accept a second parameter bind:
functionisId(id){returnliteral(`id = $id`,{ id });}User.findAll({where: isId(123),});
In its current form '?id' is a global identifier for the whole query. We should also rewrite the literal to make sure the identifier is unique. So this:
changed the title [-][RFC] support passing bind parameters directly in `Sequelize.literal()`[/-][+]support passing bind parameters directly in `Sequelize.literal()`[/+]on Dec 3, 2022
Activity
ephys commentedon Dec 3, 2022
I'm no longer pursuing, as I think #14299 would cover the same use cases better
[-][RFC] support passing bind parameters directly in `Sequelize.literal()`[/-][+]support passing bind parameters directly in `Sequelize.literal()`[/+]