Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for .single returing an Option[R] #33

Open
samikrc opened this issue Sep 15, 2024 · 1 comment
Open

Add support for .single returing an Option[R] #33

samikrc opened this issue Sep 15, 2024 · 1 comment

Comments

@samikrc
Copy link

samikrc commented Sep 15, 2024

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
Copy link
Author

samikrc commented Sep 15, 2024

Raised an initial PR: #34
@lihaoyi Please comment if the approach is correct. Will add test case once the approach is finalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant