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

Implement Issue#899: Include batch update and batch delete into the SqlTransaction #900

Merged
merged 6 commits into from
Jul 28, 2023

Conversation

balanka
Copy link
Contributor

@balanka balanka commented Jul 27, 2023

… changing the return typ of the bach delete and update from IO[Exception, List[Int]] to IO[Exception, Int]

…h delete and update from IO[Exception, List[Int]] to IO[Exception, Int]
@balanka balanka requested a review from a team as a code owner July 27, 2023 12:58
Copy link
Collaborator

@sviezypan sviezypan left a comment

Choose a reason for hiding this comment

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

hey @balanka thank you for your work. Just few tiny comments.

ZIO.attemptBlocking {
val statement = conn.createStatement()
delete.map(delete_ => statement.addBatch(renderDelete(delete_)))
statement.executeBatch().toList
statement.executeBatch().foldLeft(0) { case (acc, el) => acc + el }
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's simplify foldLeft with .sum

ZIO.attemptBlocking {
val statement = conn.createStatement()
update.map(update_ => statement.addBatch(renderUpdate(update_)))
statement.executeBatch().toList
statement.executeBatch().foldLeft(0) { case (acc, el) => acc + el }
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's simplify foldLeft with .sum

test("Transaction failed and no row was inserted updated or deleted") {
val deleteQuery = deleteFrom(customers).where(verified === false)
val id1 = UUID.randomUUID()
// val id2 = UUID.randomUUID()
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's clear the comments here and on line 113

@sviezypan sviezypan self-requested a review July 28, 2023 13:34
@sviezypan sviezypan merged commit b63708a into zio:master Jul 28, 2023
12 checks passed
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.

3 participants