valderman / selda

A type-safe, high-level SQL library for Haskell
https://selda.link
MIT License
478 stars 58 forks source link

Lack of posibility to upsert whole row, or it is poorly documented. #154

Open majkrzak opened 3 years ago

majkrzak commented 3 years ago

I was implementing insert or update operation when encountered an issue with upsert/update function.

When upserting foo::Foo I would expect to be able to do it like:

upsert tbl [foo]

Anyway, in current implementation it gets a bit more complicated due to the "update" function: (Row (Backend m) a -> Row (Backend m) a). Only way described in the docs is to use when :: Row s a -> [Assignment s a] -> Row s a. Unfortunately it requires list of assignments, when I have only full foo.

IMO, the best way will be to provide (or document if it exists) mystery_name:: a -> Row s a.