slick-pg icon indicating copy to clipboard operation
slick-pg copied to clipboard

Is it possible to implement mutable update of a array field by slick-pg query?

Open vasyaod opened this issue 6 years ago • 1 comments

If I have a raw query like:

sqlu"""UPDATE table1
         SET events = events || $event::jsonb
          WHERE field1 = $value1”””

Is it possible write request by slick-pg like:

table
  .filter(t => t.field1 === $value1)
  .map(t => t.events + $event)
  .update($event)

vasyaod avatar Jun 23 '18 21:06 vasyaod

@vasyaod you can use slick mutator API, for its usage you can see the tests for details.

tminglei avatar Jun 24 '18 07:06 tminglei