Created
December 24, 2022 22:21
-
-
Save sostenesapollo/27b539302d23ffc1a8b4e5e0e68a5168 to your computer and use it in GitHub Desktop.
Unnacent filter Prisma
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const name = 'Sóstenes Apollo'; | |
const filterText = removeAccents(`%${name}%`).toLowerCase(); | |
console.log('Filter text', filterText); | |
this.prisma.$queryRaw`select | |
id, name | |
from users | |
where LOWER(unaccent(name)) LIKE ${filterText};`.then((users) => | |
console.log(users), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-- SELECT * FROM pg_available_extensions;
-- CREATE EXTENSION unaccent;