Skip to content

Commit

Permalink
Fix example syntax in query update method (#2789)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmateusz authored Jun 25, 2023
1 parent 546acae commit 8bc6bae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/writing-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ For example when we want to return information from records that are being updat
val desc = "Update Product"
val sku = 2002L
val q = quote {
query[Product].filter(p => p.id == 42).update(_.description = lift(desc), _.sku = lift(sku)).returning(r => (r.id, r.description))
query[Product].filter(p => p.id == 42).update(_.description -> lift(desc), _.sku -> lift(sku)).returning(r => (r.id, r.description))
}
val updated = ctx.run(q) //: (Int, String)
// Postgres
Expand Down Expand Up @@ -309,7 +309,7 @@ Return *all* the records that were updated.
val desc = "Update Product"
val sku = 2002L
val q = quote {
query[Product].filter(p => p.id == 42).update(_.description = lift(desc), _.sku = lift(sku)).returning(r => (r.id, r.description))
query[Product].filter(p => p.id == 42).update(_.description -> lift(desc), _.sku -> lift(sku)).returning(r => (r.id, r.description))
}
val updated = ctx.run(q) //: List[(Int, String)]
// Postgres
Expand Down

0 comments on commit 8bc6bae

Please sign in to comment.