InArray Function not Working

Why is the drizzle Function inArray mapping my array from ['1ed01d30-d16d-4b8f-b5d0-01b2a5d94d13', '37fdf74f-4069-4eab-8eee-5ad282c66667'] to (('1ed01d30-d16d-4b8f-b5d0-01b2a5d94d13', '37fdf74f-4069-4eab-8eee-5ad282c66667')) the Double brackets are messing everything up what is goin on
12 Replies
Andrii Sherman
Andrii Sherman15mo ago
What version of drizzle-orm are you using?
Fil
Fil15mo ago
0.17.6
Andrii Sherman
Andrii Sherman15mo ago
drizzle-orm not drizzle-kit
Fil
Fil15mo ago
0.25.4
Andrii Sherman
Andrii Sherman15mo ago
Seems like a regression from 0.23.6 https://github.com/drizzle-team/drizzle-orm/issues/382
GitHub
[BUG]: "inArray" operator doesn't work as expected · Issue #382 · d...
What version of drizzle-orm are you using? 0.23.5 Describe the Bug
Andrii Sherman
Andrii Sherman15mo ago
will reopen this issue and fix asap
Fil
Fil15mo ago
Okay thanks is there a way to do the inArray function in raw SQL for now?
Andrii Sherman
Andrii Sherman15mo ago
yes
.where(sql`${table.column} in (${}, ${})`)
.where(sql`${table.column} in (${}, ${})`)
use column and values you need in templates
Fil
Fil15mo ago
could I do ${(,)} or do the brackets have to be strings?
Andrii Sherman
Andrii Sherman15mo ago
each string should be separate template to make proper query parameterizing
Fil
Fil15mo ago
aight then I wont use In cuz i need a way to search an unknown length of variables oh wait u can just pass an array in the sql statement
bloberenober
bloberenober15mo ago
yes, array param should be parens-escaped automatically