-
Hi, Given this request: I tried to generate the corresponding method which was apparently a success but with Using customSelect directly worked by modifying return customSelect(
'SELECT DISTINCT * FROM motiveCategoryRows, json_each(motiveCategoryRows.locationIds) WHERE json_each.value = :locationId',
variables: [Variable.withInt(locationId)],
readsFrom: {motiveCategoryRows},
)
.map((row) => MotiveCategory(id: row.read<int>('id'), ...))
.get(); Is there a way to tweak the generated code? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think the easiest way would be to do |
Beta Was this translation helpful? Give feedback.
I think the easiest way would be to do
WHERE CAST(json_each.value AS INT) = :locationId
. In that case, the generator should be smart enough to know that you want an int. Forjson_each
, we don't really know the type otherwise and we fall back to a string.