-
-
Notifications
You must be signed in to change notification settings - Fork 611
Description
Is your feature request related to a problem? Please describe.
I'd like some way to query using a function as part of the where condition. Concretely, I have a unique index on UPPER(payload) for some table where the payload is case-insensitive, and I want to query using WHERE UPPER(payload) = UPPER($1) (obviously, the UPPER($1) can be done in the client side, so that's less of an issue here).
Describe the solution you'd like
Unclear what the API would be.
Describe alternatives you've considered
There is a querybuilder way of doing this, but it's not what I'm looking for here.
mikro-orm/tests/QueryBuilder.test.ts
Lines 307 to 311 in bfbc5f8
| test('select with custom expression', async () => { | |
| const qb1 = orm.em.createQueryBuilder(Book2); | |
| qb1.select('*').where({ 'json_contains(`e0`.`meta`, ?)': [{ foo: 'bar' }] }); | |
| expect(qb1.getQuery()).toEqual('select `e0`.*, `e0`.price * 1.19 as `price_taxed` from `book2` as `e0` where json_contains(`e0`.`meta`, ?)'); | |
| expect(qb1.getParams()).toEqual(['{"foo":"bar"}']); |
Additional context
Add any other context about the feature request here.