Akechik
Akechik

Reputation: 21

Changing stored JSON's field's value with slick-pg

I'm using slick-pg with circe-json and I'm a bit stuck. I wonder is it possible to modify not the whole JSON, but only the value of a field? I can update JSON like this:

    db.run {
      questQuery.filter(_.json.+>>("name") === name.bind)
        .map(_.json)
        .update(newQuestJson)
    } 

But is there a way to update only one field? Something like this:

db.run {
      questQuery.filter(_.json.+>>("name") === questName.bind)
        .map(_.json.+>>(field))
        .update(newValue)
    }

Upvotes: 2

Views: 82

Answers (0)

Related Questions