Hunor Kovács
Hunor Kovács

Reputation: 1294

scala doobie: Interpolate/inject variables into complex jsonb expressions/functions like `jsonb_path_exists`

I would like to achieve, building a query like this:

fr"""jsonb_path_exists(my_teams,'$$?(@==$$team)','{"team":"$id"}')"""

to be rendered like like this:

jsonb_path_exists(my_teams,'$$?(@==$$team)','{"team":"1f057d0b-7e38-40c4-8ead-9c37b0e130b4"}')

But I don't know how could I properly inject variable id.

If anyone knows how to interpolate variables into complex jsonb expressions/functions like jsonb_path_exists, please let me know.

(using postgres, org.tpolecat:doobie-postgres:1.0.0-RC5 and all the relatives)

Upvotes: 0

Views: 29

Answers (0)

Related Questions