blob: a7ce0b53734d77e34527394290e93f2986a1c9a5 [file] [log] [blame]
Don Newton379ae252019-04-01 12:17:06 -04001package mongo
2
3import (
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.
9type 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}