[GODRIVER-191] Update the ops.Cursor type Created: 11/Jan/18  Updated: 05/Feb/18  Resolved: 05/Feb/18

Status: Closed
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 0.0.1

Type: New Feature Priority: Major - P3
Reporter: Kristofer Brandow (Inactive) Assignee: Kristofer Brandow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: GODRIVER Alpha UX

 Description   

Update the ops.Cursor type to the following:

type Cursor interface {
  Next(context.Context) bool
  Decode(interface{}) error
  Err() error
  Close(context.Context) error
}

Update the implementation of cursor to implement the new ops.Cursor interface.



 Comments   
Comment by Kristofer Brandow (Inactive) [ 05/Feb/18 ]

Code Review: https://review.gerrithub.io/c/395179/

Comment by David Golden [ 30/Jan/18 ]

Two reasons:

  • It separates decoding errors from network/server errors. If one document has a decoding error, that can be logged/skipped and iteration can continue.
  • It more closely resembles the database/sql Rows API, where Next is a bool and there is a Scan method. In our case, we Decode vs Scan since we're doing whole documents, not variadic columns.
Generated at Thu Feb 08 08:33:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.