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

Make execute_response's insert_id : int64 option #149

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

andreypopp
Copy link

To represent explicitly the case when the insert wasn't performed (can be because of ON CONFLICT clause for example).

To represent the case the insert wasn't performed.
@jongleb jongleb self-requested a review January 21, 2025 09:07
@@ -27,7 +27,7 @@ module type M = sig
type params
type row
type result
type execute_response = { affected_rows: int64; insert_id: int64 }
type execute_response = { affected_rows: int64; insert_id: int64 option }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we document that if insert_id is Some x, x is guaranteed to be greater than 0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I wonder if we can have insert_id > 0 and affected_rows = 0 (or the other way around). If not, maybe it makes sense to have instead

type execute_response = { affected_rows: int64; insert_id: int64 } option

Where both affected_rows and insert_id are guaranteed to be greater than 0 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

affected_rows > 0 and insert_id = None When UPDATE or DELETE.

@jongleb jongleb merged commit 1edf458 into ygrek:ahrefs Feb 3, 2025
1 check failed
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

Successfully merging this pull request may close these issues.

4 participants