Skip to content

Commit 2080379

Browse files
committed
Enable Session.ExecuteBatchCAS() to return underlying scan errors
The patch enables Session.ExecuteBatchCAS() to return an error which may happen during rows scanning. Patch by Bohdan Siryk; reviewed by <> for CASSGO-47
1 parent 37030fb commit 2080379

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
- Retry policy now takes into account query idempotency (CASSGO-27)
2424
- Don't return error to caller with RetryType Ignore (CASSGO-28)
25+
- Enable Session.ExecuteBatchCAS() to return underlying scan errors (CASSGO-47)
2526

2627
## [1.7.0] - 2024-09-23
2728

session.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ func (s *Session) ExecuteBatch(batch *Batch) error {
769769
// ExecuteBatchCAS executes a batch operation and returns true if successful and
770770
// an iterator (to scan additional rows if more than one conditional statement)
771771
// was sent.
772-
// Further scans on the interator must also remember to include
772+
// Further scans on the iterator must also remember to include
773773
// the applied boolean as the first argument to *Iter.Scan
774774
func (s *Session) ExecuteBatchCAS(batch *Batch, dest ...interface{}) (applied bool, iter *Iter, err error) {
775775
iter = s.executeBatch(batch)
@@ -785,7 +785,7 @@ func (s *Session) ExecuteBatchCAS(batch *Batch, dest ...interface{}) (applied bo
785785
iter.Scan(&applied)
786786
}
787787

788-
return applied, iter, nil
788+
return applied, iter, iter.err
789789
}
790790

791791
// MapExecuteBatchCAS executes a batch operation much like ExecuteBatchCAS,

0 commit comments

Comments
 (0)