K
Kysely15mo ago
Nil

hi, how do i make a select with a where that searches within a json? I'm using postgres

inside the json there is an id that I want to use to do the search, but I didn't understand how to do it, could you help me?
6 Replies
bombillazo
bombillazo15mo ago
something like this:
.where(sql`json_column->field->>'my_key'`, '=', 'value')
.where(sql`json_column->field->>'my_key'`, '=', 'value')
Igal
Igal15mo ago
Since 0.26 kysely supports type-safe json traversal. https://github.com/kysely-org/kysely/pull/440
GitHub
add json traversal support. by igalklebanov · Pull Request #440 · k...
Trying to figure out what we can do, what we should do, and how this can be scoped and explained. JSON path syntax is supported by all 3 built-in dialects. So having a type-safe JSON path builder ...
Igal
Igal15mo ago
What dialect are you using?
Nil
NilOP15mo ago
im using postgres
Nil
NilOP15mo ago
@igalklebanov I don't know what I'm doing wrong, sorry I'm newbie
No description
No description
Igal
Igal15mo ago
What Kysely version are you using?
Want results from more Discord servers?
Add your server