Closed itsravenous closed 7 years ago
Looks alright to me. You probably don't need to qualify value % 1 === 0
since it would get cast to an integer anyways.
Since primary keys can only be strings or numbers in Fortune.js anyways, this should be fine.
Aah, I guess I was thinking there could be other, non-relationship use cases (maybe you want to search an decimal[]
column). But if you're happy for this to just fix the common use case of filtering on an array relationship then great :)
I'll clean up the linting stuff anyway.
Actually that is a good point and I hadn't thought of that. The % 1
check makes sense in that case, as long as one can use an int to search in a decimal column.
I was actually thinking I didn't want to squish decimals used to search a decimal[]
into ints, but yeah, that too!
I'll just merge this with the lint problems, fix them, and release it.
Nice one!
I was trying to search via an array relationship, e.g:
but I kept getting the following pg error:
with the hint:
This really doesn't feel like the right or complete solution - I'd rather check the type of the field than the value, and I feel like this might be an issue for other types too, but this is my workaround for the moment.
Using Postgres 9.5.