scalasql icon indicating copy to clipboard operation
scalasql copied to clipboard

Add support for .single returing an Option[R]

Open samikrc opened this issue 5 months ago • 1 comments

Currently the .single method return a single row only, and errors out if there is 0 or 2+ rows. Request to change the response to an Option[R] signature, where for 0 rows the return will be None, 1 row, return the row, and for 2+ rows, return an assertion error.

The proposal is to introduce a runOption method in DbApi, which will provide a .singleOption method. This method witll return an Option[R].

samikrc avatar Sep 15 '24 17:09 samikrc