nestjsx / crud

NestJs CRUD for RESTful APIs
https://github.com/nestjsx/crud/wiki
MIT License
4.04k stars 533 forks source link

PostgresSQL like search integers, cast or setup implicit cast #708

Closed zealotrahl closed 3 years ago

zealotrahl commented 3 years ago

Good time of day, I'm using postgreSQL 13 "@nestjsx/crud": "^4.6.2", "@nestjsx/crud-typeorm": "^4.6.2", When I use "$cont" operator, crud translates it to "like" in the backend, which is fine in MySQL, in the current project I use PostgreSQL, so when I do "$cont" search on the "integer" field, it gives me an error about types. Is there a way to fix this situation?, without explicitly setting CAST(field as TEXT) in crud library?

zealotrahl commented 3 years ago

Found solution, overload "like" operator in postgres, where it autocast all fields to text. source