joao-r-reis commented on code in PR #1868: URL: https://github.com/apache/cassandra-gocql-driver/pull/1868#discussion_r2012189609
########## session.go: ########## @@ -727,33 +720,36 @@ func (s *Session) routingKeyInfo(ctx context.Context, stmt string) (*routingKeyI return routingKeyInfo, nil } -func (b *Batch) execute(ctx context.Context, conn *Conn) *Iter { - return conn.executeBatch(ctx, b) -} - // Exec executes a batch operation and returns nil if successful // otherwise an error is returned describing the failure. func (b *Batch) Exec() error { iter := b.session.executeBatch(b) return iter.Close() } +// Iter executes a batch operation and returns an Iter object +// that can be used to access properties related to the execution like Iter.Attempts and Iter.Latency +func (b *Batch) Iter() *Iter { + return b.session.executeBatch(b) Review Comment: > I feel that people may execute sequence of `Exec()` and `Iter()`. Shall we make an assertion that only one of the is invoked? They can't execute sequence (`Exec().Iter()`) unless they do it like: ``` err := b.Exec() iter := b.Iter() ``` Which I believe is already something that can be done with the current API and it will trigger two requests. We can try to improve documentation if this is a concern. +1 to what James said -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org