Documentation ¶
Overview ¶
Package iterator implements the CDC and Snapshot iterators for MongoDB. Working with them is carried out through a combined iterator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoIterator occurs when the [Combined] has no any underlying iterators. ErrNoIterator = errors.New("no iterator") )
Functions ¶
This section is empty.
Types ¶
type Combined ¶
type Combined struct {
// contains filtered or unexported fields
}
Combined is a combined iterator for MongoDB. It consists of the cdc and snapshot iterators. A snapshot is captured only if the snapshot is set to true.
func NewCombined ¶
func NewCombined(ctx context.Context, params CombinedParams) (*Combined, error)
NewCombined creates a new instance of the Combined.
func (*Combined) HasNext ¶
HasNext returns a bool indicating whether the iterator has the next record to return or not. If the underlying snapshot iterator returns false, the combined iterator will try to switch to the cdc iterator.
type CombinedParams ¶
type CombinedParams struct { Collection *mongo.Collection BatchSize int Snapshot bool OrderingField string SDKPosition sdk.Position }
CombinedParams is an incoming params for the NewCombined function.
Click to show internal directories.
Click to hide internal directories.