feat: replace NewBetchInserter function name (#2769)
This commit is contained in:
@@ -25,25 +25,15 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// Deprecated. Use NewBatchInserter instead.
|
||||
func NewBulkInserter(coll *mongo.Collection, interval ...time.Duration) *BulkInserter {
|
||||
return newBulkInserter(coll, interval...)
|
||||
}
|
||||
|
||||
// NewBatchInserter returns a BulkInserter.
|
||||
func NewBatchInserter(coll Collection, interval ...time.Duration) (*BulkInserter, error) {
|
||||
// NewBulkInserter returns a BulkInserter.
|
||||
func NewBulkInserter(coll Collection, interval ...time.Duration) (*BulkInserter, error) {
|
||||
cloneColl, err := coll.Clone()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return newBulkInserter(cloneColl, interval...), nil
|
||||
}
|
||||
|
||||
// newBulkInserter returns a BulkInserter.
|
||||
func newBulkInserter(coll *mongo.Collection, interval ...time.Duration) *BulkInserter {
|
||||
inserter := &dbInserter{
|
||||
collection: coll,
|
||||
collection: cloneColl,
|
||||
}
|
||||
|
||||
duration := flushInterval
|
||||
@@ -54,7 +44,7 @@ func newBulkInserter(coll *mongo.Collection, interval ...time.Duration) *BulkIns
|
||||
return &BulkInserter{
|
||||
executor: executors.NewPeriodicalExecutor(duration, inserter),
|
||||
inserter: inserter,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Flush flushes the inserter, writes all pending records.
|
||||
|
||||
Reference in New Issue
Block a user