Don Newton | 379ae25 | 2019-04-01 12:17:06 -0400 | [diff] [blame^] | 1 | package mongo |
| 2 | |
| 3 | import ( |
| 4 | "context" |
| 5 | ) |
| 6 | |
| 7 | // batchCursor is the interface implemented by types that can provide batches of document results. |
| 8 | // The Cursor type is built on top of this type. |
| 9 | type batchCursor interface { |
| 10 | // ID returns the ID of the cursor. |
| 11 | ID() int64 |
| 12 | |
| 13 | // Next returns true if there is a batch available. |
| 14 | Next(context.Context) bool |
| 15 | |
| 16 | // Batch appends the current batch of documents to dst. RequiredBytes can be used to determine |
| 17 | // the length of the current batch of documents. |
| 18 | // |
| 19 | // If there is no batch available, this method should do nothing. |
| 20 | Batch(dst []byte) []byte |
| 21 | |
| 22 | // RequiredBytes returns the number of bytes required fo rthe current batch. |
| 23 | RequiredBytes() int |
| 24 | |
| 25 | // Err returns the last error encountered. |
| 26 | Err() error |
| 27 | |
| 28 | // Close closes the cursor. |
| 29 | Close(context.Context) error |
| 30 | } |