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

Enhancement: traits for uniqueness #1694

Open
ishitatsuyuki opened this Issue May 15, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@ishitatsuyuki

ishitatsuyuki commented May 15, 2018

The basic idea is that columns with uniqueness constraints are guaranteed to return exactly zero or one value.

In some code we may want to assert this for consistency, and having this also eliminates the need for a redundant LIMIT as well.

My idea is to have a one() method to execute queries which statically requires the query to return at most one value.

@sgrif

This comment has been minimized.

Member

sgrif commented May 22, 2018

Fun fact: This is from the release notes of 0.2.0, when get_result was first introduced.

In the future, get_result may also check that only a single row was affected.

(We can't actually change the behavior now)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment