Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (30 sloc) 1.13 KB
package mongo
import (
"context"
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
"go.mongodb.org/mongo-driver/x/mongo/driver"
)
// batchCursor is the interface implemented by types that can provide batches of document results.
// The Cursor type is built on top of this type.
type batchCursor interface {
// ID returns the ID of the cursor.
ID() int64
// Next returns true if there is a batch available.
Next(context.Context) bool
// Batch will return a DocumentSequence for the current batch of documents. The returned
// DocumentSequence is only valid until the next call to Next or Close.
Batch() *bsoncore.DocumentSequence
// Server returns a pointer to the cursor's server.
Server() driver.Server
// Err returns the last error encountered.
Err() error
// Close closes the cursor.
Close(context.Context) error
}
// pbrtBatchCursor is the interface implemented by batch cursors that also provide the functionality for retrieving
// a postBatchResumeToken from commands.
type pbrtBatchCursor interface {
batchCursor
// PostBatchResumeToken returns the latest seen post batch resume token.
PostBatchResumeToken() bsoncore.Document
}
You can’t perform that action at this time.