You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I have a column with a jsonb type, and I supply $type, there should be a native way for me to query this field without having to use the sql operator and rawdog the SQL here. The $type field gives correct typings but returned data from queries, but if I want to query into the JSON, the types should already be there and have some native support for querying this.
There is no type safety here. If I update, the typing of myData in the schema file, I won't get any type error in this query. I should be able to have a more ergonomic query that also provides type safety. Something like:
Someone implemented a cool type-safe JSON util here #1511 (comment). My TS server ground to a halt when using it though :D But nonetheless that's a nice concept.
It makes me almost dizzy to think if jsonb_path_query would be type-safe, or if there'd be an abstraction on top of it. It's so capable.
Describe what you want
If I have a column with a
jsonb
type, and I supply$type
, there should be a native way for me to query this field without having to use the sql operator and rawdog the SQL here. The$type
field gives correct typings but returned data from queries, but if I want to query into the JSON, the types should already be there and have some native support for querying this.For instance, say I have:
and I want to find a row where a.b === value. Right now, I have to do something like this:
There is no type safety here. If I update, the typing of
myData
in the schema file, I won't get any type error in this query. I should be able to have a more ergonomic query that also provides type safety. Something like:Prisma also has a means of doing this that works well: https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/working-with-json-fields#filter-on-nested-object-property
The text was updated successfully, but these errors were encountered: