Documentation
¶
Overview ¶
Package mon is a generated GoMock package.
Package mon is a generated GoMock package.
Package mon is a generated GoMock package.
Index ¶
- Variables
- func DisableInfoLog()
- func DisableLog()
- func FormatAddr(hosts []string) string
- func Inject(key string, client *mongo.Client)
- func SetSlowThreshold(threshold time.Duration)
- type BulkInserter
- type ClosableClient
- type Collection
- type MockCollection
- func (m *MockCollection) Aggregate(ctx context.Context, pipeline any, ...) (*mongo.Cursor, error)
- func (m *MockCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (m *MockCollection) Clone(opts ...options.Lister[options.CollectionOptions]) *mongo.Collection
- func (m *MockCollection) CountDocuments(ctx context.Context, filter any, opts ...options.Lister[options.CountOptions]) (int64, error)
- func (m *MockCollection) Database() *mongo.Database
- func (m *MockCollection) DeleteMany(ctx context.Context, filter any, ...) (*mongo.DeleteResult, error)
- func (m *MockCollection) DeleteOne(ctx context.Context, filter any, ...) (*mongo.DeleteResult, error)
- func (m *MockCollection) Distinct(ctx context.Context, fieldName string, filter any, ...) (*mongo.DistinctResult, error)
- func (m *MockCollection) Drop(ctx context.Context, opts ...options.Lister[options.DropCollectionOptions]) error
- func (m *MockCollection) EXPECT() *MockCollectionMockRecorder
- func (m *MockCollection) EstimatedDocumentCount(ctx context.Context, ...) (int64, error)
- func (m *MockCollection) Find(ctx context.Context, filter any, opts ...options.Lister[options.FindOptions]) (*mongo.Cursor, error)
- func (m *MockCollection) FindOne(ctx context.Context, filter any, ...) (*mongo.SingleResult, error)
- func (m *MockCollection) FindOneAndDelete(ctx context.Context, filter any, ...) (*mongo.SingleResult, error)
- func (m *MockCollection) FindOneAndReplace(ctx context.Context, filter, replacement any, ...) (*mongo.SingleResult, error)
- func (m *MockCollection) FindOneAndUpdate(ctx context.Context, filter, update any, ...) (*mongo.SingleResult, error)
- func (m *MockCollection) Indexes() mongo.IndexView
- func (m *MockCollection) InsertMany(ctx context.Context, documents []any, ...) (*mongo.InsertManyResult, error)
- func (m *MockCollection) InsertOne(ctx context.Context, document any, ...) (*mongo.InsertOneResult, error)
- func (m *MockCollection) ReplaceOne(ctx context.Context, filter, replacement any, ...) (*mongo.UpdateResult, error)
- func (m *MockCollection) UpdateByID(ctx context.Context, id, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockCollection) UpdateMany(ctx context.Context, filter, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockCollection) UpdateOne(ctx context.Context, filter, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockCollection) Watch(ctx context.Context, pipeline any, ...) (*mongo.ChangeStream, error)
- type MockCollectionMockRecorder
- func (mr *MockCollectionMockRecorder) Aggregate(ctx, pipeline any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) BulkWrite(ctx, models any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Clone(opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) CountDocuments(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Database() *gomock.Call
- func (mr *MockCollectionMockRecorder) DeleteMany(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) DeleteOne(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Distinct(ctx, fieldName, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Drop(ctx any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) EstimatedDocumentCount(ctx any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Find(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) FindOne(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) FindOneAndDelete(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) FindOneAndReplace(ctx, filter, replacement any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) FindOneAndUpdate(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Indexes() *gomock.Call
- func (mr *MockCollectionMockRecorder) InsertMany(ctx, documents any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) InsertOne(ctx, document any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) ReplaceOne(ctx, filter, replacement any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) UpdateByID(ctx, id, update any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) UpdateMany(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) UpdateOne(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockCollectionMockRecorder) Watch(ctx, pipeline any, opts ...any) *gomock.Call
- type MockcollectionInserter
- type MockcollectionInserterMockRecorder
- type MockmonClient
- type MockmonClientMockRecorder
- type MockmonCollection
- func (m *MockmonCollection) Aggregate(ctx context.Context, pipeline any, ...) (*mongo.Cursor, error)
- func (m *MockmonCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (m *MockmonCollection) Clone(opts ...options.Lister[options.CollectionOptions]) *mongo.Collection
- func (m *MockmonCollection) CountDocuments(ctx context.Context, filter any, opts ...options.Lister[options.CountOptions]) (int64, error)
- func (m *MockmonCollection) Database() *mongo.Database
- func (m *MockmonCollection) DeleteMany(ctx context.Context, filter any, ...) (*mongo.DeleteResult, error)
- func (m *MockmonCollection) DeleteOne(ctx context.Context, filter any, ...) (*mongo.DeleteResult, error)
- func (m *MockmonCollection) Distinct(ctx context.Context, fieldName string, filter any, ...) *mongo.DistinctResult
- func (m *MockmonCollection) Drop(ctx context.Context, opts ...options.Lister[options.DropCollectionOptions]) error
- func (m *MockmonCollection) EXPECT() *MockmonCollectionMockRecorder
- func (m *MockmonCollection) EstimatedDocumentCount(ctx context.Context, ...) (int64, error)
- func (m *MockmonCollection) Find(ctx context.Context, filter any, opts ...options.Lister[options.FindOptions]) (*mongo.Cursor, error)
- func (m *MockmonCollection) FindOne(ctx context.Context, filter any, ...) *mongo.SingleResult
- func (m *MockmonCollection) FindOneAndDelete(ctx context.Context, filter any, ...) *mongo.SingleResult
- func (m *MockmonCollection) FindOneAndReplace(ctx context.Context, filter, replacement any, ...) *mongo.SingleResult
- func (m *MockmonCollection) FindOneAndUpdate(ctx context.Context, filter, update any, ...) *mongo.SingleResult
- func (m *MockmonCollection) Indexes() mongo.IndexView
- func (m *MockmonCollection) InsertMany(ctx context.Context, documents any, ...) (*mongo.InsertManyResult, error)
- func (m *MockmonCollection) InsertOne(ctx context.Context, document any, ...) (*mongo.InsertOneResult, error)
- func (m *MockmonCollection) ReplaceOne(ctx context.Context, filter, replacement any, ...) (*mongo.UpdateResult, error)
- func (m *MockmonCollection) UpdateByID(ctx context.Context, id, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockmonCollection) UpdateMany(ctx context.Context, filter, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockmonCollection) UpdateOne(ctx context.Context, filter, update any, ...) (*mongo.UpdateResult, error)
- func (m *MockmonCollection) Watch(ctx context.Context, pipeline any, ...) (*mongo.ChangeStream, error)
- type MockmonCollectionMockRecorder
- func (mr *MockmonCollectionMockRecorder) Aggregate(ctx, pipeline any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) BulkWrite(ctx, models any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Clone(opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) CountDocuments(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Database() *gomock.Call
- func (mr *MockmonCollectionMockRecorder) DeleteMany(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) DeleteOne(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Distinct(ctx, fieldName, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Drop(ctx any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) EstimatedDocumentCount(ctx any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Find(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) FindOne(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) FindOneAndDelete(ctx, filter any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) FindOneAndReplace(ctx, filter, replacement any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) FindOneAndUpdate(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Indexes() *gomock.Call
- func (mr *MockmonCollectionMockRecorder) InsertMany(ctx, documents any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) InsertOne(ctx, document any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) ReplaceOne(ctx, filter, replacement any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) UpdateByID(ctx, id, update any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) UpdateMany(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) UpdateOne(ctx, filter, update any, opts ...any) *gomock.Call
- func (mr *MockmonCollectionMockRecorder) Watch(ctx, pipeline any, opts ...any) *gomock.Call
- type MockmonSession
- func (m *MockmonSession) AbortTransaction(ctx context.Context) error
- func (m *MockmonSession) CommitTransaction(ctx context.Context) error
- func (m *MockmonSession) EXPECT() *MockmonSessionMockRecorder
- func (m *MockmonSession) EndSession(ctx context.Context)
- func (m *MockmonSession) WithTransaction(ctx context.Context, fn func(context.Context) (any, error), ...) (any, error)
- type MockmonSessionMockRecorder
- func (mr *MockmonSessionMockRecorder) AbortTransaction(ctx any) *gomock.Call
- func (mr *MockmonSessionMockRecorder) CommitTransaction(ctx any) *gomock.Call
- func (mr *MockmonSessionMockRecorder) EndSession(ctx any) *gomock.Call
- func (mr *MockmonSessionMockRecorder) WithTransaction(ctx, fn any, opts ...any) *gomock.Call
- type Model
- func (m *Model) Aggregate(ctx context.Context, v, pipeline any, ...) error
- func (m *Model) DeleteMany(ctx context.Context, filter any, ...) (int64, error)
- func (m *Model) DeleteOne(ctx context.Context, filter any, ...) (int64, error)
- func (m *Model) Find(ctx context.Context, v, filter any, ...) error
- func (m *Model) FindOne(ctx context.Context, v, filter any, ...) error
- func (m *Model) FindOneAndDelete(ctx context.Context, v, filter any, ...) error
- func (m *Model) FindOneAndReplace(ctx context.Context, v, filter, replacement any, ...) error
- func (m *Model) FindOneAndUpdate(ctx context.Context, v, filter, update any, ...) error
- func (m *Model) StartSession(opts ...options.Lister[options.SessionOptions]) (sess *Session, err error)
- type Option
- type ResultHandler
- type Session
- func (w *Session) AbortTransaction(ctx context.Context) (err error)
- func (w *Session) CommitTransaction(ctx context.Context) (err error)
- func (w *Session) EndSession(ctx context.Context)
- func (w *Session) WithTransaction(ctx context.Context, fn func(sessCtx context.Context) (any, error), ...) (res any, err error)
- type TypeCodec
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = mongo.ErrNoDocuments
ErrNotFound is an alias of mongo.ErrNoDocuments
Functions ¶
func DisableInfoLog ¶ added in v1.6.0
func DisableInfoLog()
DisableInfoLog disables info logging of mongo commands, but keeps slow logs.
func DisableLog ¶ added in v1.6.0
func DisableLog()
DisableLog disables logging of mongo commands, includes info and slow logs.
func FormatAddr ¶
FormatAddr formats mongo hosts to a string.
func Inject ¶
Inject injects a *mongo.Client into the client manager. Typically, this is used to inject a *mongo.Client for test purpose.
func SetSlowThreshold ¶
SetSlowThreshold sets the slow threshold.
Types ¶
type BulkInserter ¶
type BulkInserter struct {
// contains filtered or unexported fields
}
A BulkInserter is used to insert bulk of mongo records.
func NewBulkInserter ¶
func NewBulkInserter(coll Collection, interval ...time.Duration) (*BulkInserter, error)
NewBulkInserter returns a BulkInserter.
func (*BulkInserter) Flush ¶
func (bi *BulkInserter) Flush()
Flush flushes the inserter, writes all pending records.
func (*BulkInserter) SetResultHandler ¶
func (bi *BulkInserter) SetResultHandler(handler ResultHandler)
SetResultHandler sets the result handler.
type ClosableClient ¶
ClosableClient wraps *mongo.Client and provides a Close method.
func (*ClosableClient) Close ¶
func (cs *ClosableClient) Close() error
Close disconnects the underlying *mongo.Client.
type Collection ¶
type Collection interface {
// Aggregate executes an aggregation pipeline.
Aggregate(ctx context.Context, pipeline any, opts ...options.Lister[options.AggregateOptions]) (
*mongo.Cursor, error)
// BulkWrite performs a bulk write operation.
BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...options.Lister[options.BulkWriteOptions]) (
*mongo.BulkWriteResult, error)
// Clone creates a copy of this collection with the same settings.
Clone(opts ...options.Lister[options.CollectionOptions]) *mongo.Collection
// CountDocuments returns the number of documents in the collection that match the filter.
CountDocuments(ctx context.Context, filter any, opts ...options.Lister[options.CountOptions]) (int64, error)
// Database returns the database that this collection is a part of.
Database() *mongo.Database
// DeleteMany deletes documents from the collection that match the filter.
DeleteMany(ctx context.Context, filter any, opts ...options.Lister[options.DeleteManyOptions]) (
*mongo.DeleteResult, error)
// DeleteOne deletes at most one document from the collection that matches the filter.
DeleteOne(ctx context.Context, filter any, opts ...options.Lister[options.DeleteOneOptions]) (
*mongo.DeleteResult, error)
// Distinct returns a list of distinct values for the given key across the collection.
Distinct(ctx context.Context, fieldName string, filter any,
opts ...options.Lister[options.DistinctOptions]) (*mongo.DistinctResult, error)
// Drop drops this collection from database.
Drop(ctx context.Context, opts ...options.Lister[options.DropCollectionOptions]) error
// EstimatedDocumentCount returns an estimate of the count of documents in a collection
// using collection metadata.
EstimatedDocumentCount(ctx context.Context, opts ...options.Lister[options.EstimatedDocumentCountOptions]) (int64, error)
// Find finds the documents matching the provided filter.
Find(ctx context.Context, filter any, opts ...options.Lister[options.FindOptions]) (*mongo.Cursor, error)
// FindOne returns up to one document that matches the provided filter.
FindOne(ctx context.Context, filter any, opts ...options.Lister[options.FindOneOptions]) (
*mongo.SingleResult, error)
// FindOneAndDelete returns at most one document that matches the filter. If the filter
// matches multiple documents, only the first document is deleted.
FindOneAndDelete(ctx context.Context, filter any, opts ...options.Lister[options.FindOneAndDeleteOptions]) (
*mongo.SingleResult, error)
// FindOneAndReplace returns at most one document that matches the filter. If the filter
// matches multiple documents, FindOneAndReplace returns the first document in the
// collection that matches the filter.
FindOneAndReplace(ctx context.Context, filter, replacement any,
opts ...options.Lister[options.FindOneAndReplaceOptions]) (*mongo.SingleResult, error)
// FindOneAndUpdate returns at most one document that matches the filter. If the filter
// matches multiple documents, FindOneAndUpdate returns the first document in the
// collection that matches the filter.
FindOneAndUpdate(ctx context.Context, filter, update any,
opts ...options.Lister[options.FindOneAndUpdateOptions]) (*mongo.SingleResult, error)
// Indexes returns the index view for this collection.
Indexes() mongo.IndexView
// InsertMany inserts the provided documents.
InsertMany(ctx context.Context, documents []any, opts ...options.Lister[options.InsertManyOptions]) (
*mongo.InsertManyResult, error)
// InsertOne inserts the provided document.
InsertOne(ctx context.Context, document any, opts ...options.Lister[options.InsertOneOptions]) (
*mongo.InsertOneResult, error)
// ReplaceOne replaces at most one document that matches the filter.
ReplaceOne(ctx context.Context, filter, replacement any,
opts ...options.Lister[options.ReplaceOptions]) (*mongo.UpdateResult, error)
// UpdateByID updates a single document matching the provided filter.
UpdateByID(ctx context.Context, id, update any,
opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
// UpdateMany updates the provided documents.
UpdateMany(ctx context.Context, filter, update any,
opts ...options.Lister[options.UpdateManyOptions]) (*mongo.UpdateResult, error)
// UpdateOne updates a single document matching the provided filter.
UpdateOne(ctx context.Context, filter, update any,
opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
// Watch returns a change stream cursor used to receive notifications of changes to the collection.
Watch(ctx context.Context, pipeline any, opts ...options.Lister[options.ChangeStreamOptions]) (
*mongo.ChangeStream, error)
}
Collection defines a MongoDB collection.
type MockCollection ¶ added in v1.9.0
type MockCollection struct {
// contains filtered or unexported fields
}
MockCollection is a mock of Collection interface.
func NewMockCollection ¶ added in v1.9.0
func NewMockCollection(ctrl *gomock.Controller) *MockCollection
NewMockCollection creates a new mock instance.
func (*MockCollection) Aggregate ¶ added in v1.9.0
func (m *MockCollection) Aggregate(ctx context.Context, pipeline any, opts ...options.Lister[options.AggregateOptions]) (*mongo.Cursor, error)
Aggregate mocks base method.
func (*MockCollection) BulkWrite ¶ added in v1.9.0
func (m *MockCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...options.Lister[options.BulkWriteOptions]) (*mongo.BulkWriteResult, error)
BulkWrite mocks base method.
func (*MockCollection) Clone ¶ added in v1.9.0
func (m *MockCollection) Clone(opts ...options.Lister[options.CollectionOptions]) *mongo.Collection
Clone mocks base method.
func (*MockCollection) CountDocuments ¶ added in v1.9.0
func (m *MockCollection) CountDocuments(ctx context.Context, filter any, opts ...options.Lister[options.CountOptions]) (int64, error)
CountDocuments mocks base method.
func (*MockCollection) Database ¶ added in v1.9.0
func (m *MockCollection) Database() *mongo.Database
Database mocks base method.
func (*MockCollection) DeleteMany ¶ added in v1.9.0
func (m *MockCollection) DeleteMany(ctx context.Context, filter any, opts ...options.Lister[options.DeleteManyOptions]) (*mongo.DeleteResult, error)
DeleteMany mocks base method.
func (*MockCollection) DeleteOne ¶ added in v1.9.0
func (m *MockCollection) DeleteOne(ctx context.Context, filter any, opts ...options.Lister[options.DeleteOneOptions]) (*mongo.DeleteResult, error)
DeleteOne mocks base method.
func (*MockCollection) Distinct ¶ added in v1.9.0
func (m *MockCollection) Distinct(ctx context.Context, fieldName string, filter any, opts ...options.Lister[options.DistinctOptions]) (*mongo.DistinctResult, error)
Distinct mocks base method.
func (*MockCollection) Drop ¶ added in v1.9.0
func (m *MockCollection) Drop(ctx context.Context, opts ...options.Lister[options.DropCollectionOptions]) error
Drop mocks base method.
func (*MockCollection) EXPECT ¶ added in v1.9.0
func (m *MockCollection) EXPECT() *MockCollectionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockCollection) EstimatedDocumentCount ¶ added in v1.9.0
func (m *MockCollection) EstimatedDocumentCount(ctx context.Context, opts ...options.Lister[options.EstimatedDocumentCountOptions]) (int64, error)
EstimatedDocumentCount mocks base method.
func (*MockCollection) Find ¶ added in v1.9.0
func (m *MockCollection) Find(ctx context.Context, filter any, opts ...options.Lister[options.FindOptions]) (*mongo.Cursor, error)
Find mocks base method.
func (*MockCollection) FindOne ¶ added in v1.9.0
func (m *MockCollection) FindOne(ctx context.Context, filter any, opts ...options.Lister[options.FindOneOptions]) (*mongo.SingleResult, error)
FindOne mocks base method.
func (*MockCollection) FindOneAndDelete ¶ added in v1.9.0
func (m *MockCollection) FindOneAndDelete(ctx context.Context, filter any, opts ...options.Lister[options.FindOneAndDeleteOptions]) (*mongo.SingleResult, error)
FindOneAndDelete mocks base method.
func (*MockCollection) FindOneAndReplace ¶ added in v1.9.0
func (m *MockCollection) FindOneAndReplace(ctx context.Context, filter, replacement any, opts ...options.Lister[options.FindOneAndReplaceOptions]) (*mongo.SingleResult, error)
FindOneAndReplace mocks base method.
func (*MockCollection) FindOneAndUpdate ¶ added in v1.9.0
func (m *MockCollection) FindOneAndUpdate(ctx context.Context, filter, update any, opts ...options.Lister[options.FindOneAndUpdateOptions]) (*mongo.SingleResult, error)
FindOneAndUpdate mocks base method.
func (*MockCollection) Indexes ¶ added in v1.9.0
func (m *MockCollection) Indexes() mongo.IndexView
Indexes mocks base method.
func (*MockCollection) InsertMany ¶ added in v1.9.0
func (m *MockCollection) InsertMany(ctx context.Context, documents []any, opts ...options.Lister[options.InsertManyOptions]) (*mongo.InsertManyResult, error)
InsertMany mocks base method.
func (*MockCollection) InsertOne ¶ added in v1.9.0
func (m *MockCollection) InsertOne(ctx context.Context, document any, opts ...options.Lister[options.InsertOneOptions]) (*mongo.InsertOneResult, error)
InsertOne mocks base method.
func (*MockCollection) ReplaceOne ¶ added in v1.9.0
func (m *MockCollection) ReplaceOne(ctx context.Context, filter, replacement any, opts ...options.Lister[options.ReplaceOptions]) (*mongo.UpdateResult, error)
ReplaceOne mocks base method.
func (*MockCollection) UpdateByID ¶ added in v1.9.0
func (m *MockCollection) UpdateByID(ctx context.Context, id, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
UpdateByID mocks base method.
func (*MockCollection) UpdateMany ¶ added in v1.9.0
func (m *MockCollection) UpdateMany(ctx context.Context, filter, update any, opts ...options.Lister[options.UpdateManyOptions]) (*mongo.UpdateResult, error)
UpdateMany mocks base method.
func (*MockCollection) UpdateOne ¶ added in v1.9.0
func (m *MockCollection) UpdateOne(ctx context.Context, filter, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
UpdateOne mocks base method.
func (*MockCollection) Watch ¶ added in v1.9.0
func (m *MockCollection) Watch(ctx context.Context, pipeline any, opts ...options.Lister[options.ChangeStreamOptions]) (*mongo.ChangeStream, error)
Watch mocks base method.
type MockCollectionMockRecorder ¶ added in v1.9.0
type MockCollectionMockRecorder struct {
// contains filtered or unexported fields
}
MockCollectionMockRecorder is the mock recorder for MockCollection.
func (*MockCollectionMockRecorder) Aggregate ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Aggregate(ctx, pipeline any, opts ...any) *gomock.Call
Aggregate indicates an expected call of Aggregate.
func (*MockCollectionMockRecorder) BulkWrite ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) BulkWrite(ctx, models any, opts ...any) *gomock.Call
BulkWrite indicates an expected call of BulkWrite.
func (*MockCollectionMockRecorder) Clone ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Clone(opts ...any) *gomock.Call
Clone indicates an expected call of Clone.
func (*MockCollectionMockRecorder) CountDocuments ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) CountDocuments(ctx, filter any, opts ...any) *gomock.Call
CountDocuments indicates an expected call of CountDocuments.
func (*MockCollectionMockRecorder) Database ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Database() *gomock.Call
Database indicates an expected call of Database.
func (*MockCollectionMockRecorder) DeleteMany ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) DeleteMany(ctx, filter any, opts ...any) *gomock.Call
DeleteMany indicates an expected call of DeleteMany.
func (*MockCollectionMockRecorder) DeleteOne ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) DeleteOne(ctx, filter any, opts ...any) *gomock.Call
DeleteOne indicates an expected call of DeleteOne.
func (*MockCollectionMockRecorder) Distinct ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Distinct(ctx, fieldName, filter any, opts ...any) *gomock.Call
Distinct indicates an expected call of Distinct.
func (*MockCollectionMockRecorder) Drop ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Drop(ctx any, opts ...any) *gomock.Call
Drop indicates an expected call of Drop.
func (*MockCollectionMockRecorder) EstimatedDocumentCount ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) EstimatedDocumentCount(ctx any, opts ...any) *gomock.Call
EstimatedDocumentCount indicates an expected call of EstimatedDocumentCount.
func (*MockCollectionMockRecorder) Find ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Find(ctx, filter any, opts ...any) *gomock.Call
Find indicates an expected call of Find.
func (*MockCollectionMockRecorder) FindOne ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) FindOne(ctx, filter any, opts ...any) *gomock.Call
FindOne indicates an expected call of FindOne.
func (*MockCollectionMockRecorder) FindOneAndDelete ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) FindOneAndDelete(ctx, filter any, opts ...any) *gomock.Call
FindOneAndDelete indicates an expected call of FindOneAndDelete.
func (*MockCollectionMockRecorder) FindOneAndReplace ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) FindOneAndReplace(ctx, filter, replacement any, opts ...any) *gomock.Call
FindOneAndReplace indicates an expected call of FindOneAndReplace.
func (*MockCollectionMockRecorder) FindOneAndUpdate ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) FindOneAndUpdate(ctx, filter, update any, opts ...any) *gomock.Call
FindOneAndUpdate indicates an expected call of FindOneAndUpdate.
func (*MockCollectionMockRecorder) Indexes ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) Indexes() *gomock.Call
Indexes indicates an expected call of Indexes.
func (*MockCollectionMockRecorder) InsertMany ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) InsertMany(ctx, documents any, opts ...any) *gomock.Call
InsertMany indicates an expected call of InsertMany.
func (*MockCollectionMockRecorder) InsertOne ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) InsertOne(ctx, document any, opts ...any) *gomock.Call
InsertOne indicates an expected call of InsertOne.
func (*MockCollectionMockRecorder) ReplaceOne ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) ReplaceOne(ctx, filter, replacement any, opts ...any) *gomock.Call
ReplaceOne indicates an expected call of ReplaceOne.
func (*MockCollectionMockRecorder) UpdateByID ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) UpdateByID(ctx, id, update any, opts ...any) *gomock.Call
UpdateByID indicates an expected call of UpdateByID.
func (*MockCollectionMockRecorder) UpdateMany ¶ added in v1.9.0
func (mr *MockCollectionMockRecorder) UpdateMany(ctx, filter, update any, opts ...any) *gomock.Call
UpdateMany indicates an expected call of UpdateMany.
type MockcollectionInserter ¶ added in v1.9.0
type MockcollectionInserter struct {
// contains filtered or unexported fields
}
MockcollectionInserter is a mock of collectionInserter interface.
func NewMockcollectionInserter ¶ added in v1.9.0
func NewMockcollectionInserter(ctrl *gomock.Controller) *MockcollectionInserter
NewMockcollectionInserter creates a new mock instance.
func (*MockcollectionInserter) EXPECT ¶ added in v1.9.0
func (m *MockcollectionInserter) EXPECT() *MockcollectionInserterMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockcollectionInserter) InsertMany ¶ added in v1.9.0
func (m *MockcollectionInserter) InsertMany(ctx context.Context, documents any, opts ...options.Lister[options.InsertManyOptions]) (*mongo.InsertManyResult, error)
InsertMany mocks base method.
type MockcollectionInserterMockRecorder ¶ added in v1.9.0
type MockcollectionInserterMockRecorder struct {
// contains filtered or unexported fields
}
MockcollectionInserterMockRecorder is the mock recorder for MockcollectionInserter.
func (*MockcollectionInserterMockRecorder) InsertMany ¶ added in v1.9.0
func (mr *MockcollectionInserterMockRecorder) InsertMany(ctx, documents any, opts ...any) *gomock.Call
InsertMany indicates an expected call of InsertMany.
type MockmonClient ¶ added in v1.9.0
type MockmonClient struct {
// contains filtered or unexported fields
}
MockmonClient is a mock of monClient interface.
func NewMockmonClient ¶ added in v1.9.0
func NewMockmonClient(ctrl *gomock.Controller) *MockmonClient
NewMockmonClient creates a new mock instance.
func (*MockmonClient) EXPECT ¶ added in v1.9.0
func (m *MockmonClient) EXPECT() *MockmonClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockmonClient) StartSession ¶ added in v1.9.0
func (m *MockmonClient) StartSession(opts ...options.Lister[options.SessionOptions]) (monSession, error)
StartSession mocks base method.
type MockmonClientMockRecorder ¶ added in v1.9.0
type MockmonClientMockRecorder struct {
// contains filtered or unexported fields
}
MockmonClientMockRecorder is the mock recorder for MockmonClient.
func (*MockmonClientMockRecorder) StartSession ¶ added in v1.9.0
func (mr *MockmonClientMockRecorder) StartSession(opts ...any) *gomock.Call
StartSession indicates an expected call of StartSession.
type MockmonCollection ¶ added in v1.9.0
type MockmonCollection struct {
// contains filtered or unexported fields
}
MockmonCollection is a mock of monCollection interface.
func NewMockmonCollection ¶ added in v1.9.0
func NewMockmonCollection(ctrl *gomock.Controller) *MockmonCollection
NewMockmonCollection creates a new mock instance.
func (*MockmonCollection) Aggregate ¶ added in v1.9.0
func (m *MockmonCollection) Aggregate(ctx context.Context, pipeline any, opts ...options.Lister[options.AggregateOptions]) (*mongo.Cursor, error)
Aggregate mocks base method.
func (*MockmonCollection) BulkWrite ¶ added in v1.9.0
func (m *MockmonCollection) BulkWrite(ctx context.Context, models []mongo.WriteModel, opts ...options.Lister[options.BulkWriteOptions]) (*mongo.BulkWriteResult, error)
BulkWrite mocks base method.
func (*MockmonCollection) Clone ¶ added in v1.9.0
func (m *MockmonCollection) Clone(opts ...options.Lister[options.CollectionOptions]) *mongo.Collection
Clone mocks base method.
func (*MockmonCollection) CountDocuments ¶ added in v1.9.0
func (m *MockmonCollection) CountDocuments(ctx context.Context, filter any, opts ...options.Lister[options.CountOptions]) (int64, error)
CountDocuments mocks base method.
func (*MockmonCollection) Database ¶ added in v1.9.0
func (m *MockmonCollection) Database() *mongo.Database
Database mocks base method.
func (*MockmonCollection) DeleteMany ¶ added in v1.9.0
func (m *MockmonCollection) DeleteMany(ctx context.Context, filter any, opts ...options.Lister[options.DeleteManyOptions]) (*mongo.DeleteResult, error)
DeleteMany mocks base method.
func (*MockmonCollection) DeleteOne ¶ added in v1.9.0
func (m *MockmonCollection) DeleteOne(ctx context.Context, filter any, opts ...options.Lister[options.DeleteOneOptions]) (*mongo.DeleteResult, error)
DeleteOne mocks base method.
func (*MockmonCollection) Distinct ¶ added in v1.9.0
func (m *MockmonCollection) Distinct(ctx context.Context, fieldName string, filter any, opts ...options.Lister[options.DistinctOptions]) *mongo.DistinctResult
Distinct mocks base method.
func (*MockmonCollection) Drop ¶ added in v1.9.0
func (m *MockmonCollection) Drop(ctx context.Context, opts ...options.Lister[options.DropCollectionOptions]) error
Drop mocks base method.
func (*MockmonCollection) EXPECT ¶ added in v1.9.0
func (m *MockmonCollection) EXPECT() *MockmonCollectionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockmonCollection) EstimatedDocumentCount ¶ added in v1.9.0
func (m *MockmonCollection) EstimatedDocumentCount(ctx context.Context, opts ...options.Lister[options.EstimatedDocumentCountOptions]) (int64, error)
EstimatedDocumentCount mocks base method.
func (*MockmonCollection) Find ¶ added in v1.9.0
func (m *MockmonCollection) Find(ctx context.Context, filter any, opts ...options.Lister[options.FindOptions]) (*mongo.Cursor, error)
Find mocks base method.
func (*MockmonCollection) FindOne ¶ added in v1.9.0
func (m *MockmonCollection) FindOne(ctx context.Context, filter any, opts ...options.Lister[options.FindOneOptions]) *mongo.SingleResult
FindOne mocks base method.
func (*MockmonCollection) FindOneAndDelete ¶ added in v1.9.0
func (m *MockmonCollection) FindOneAndDelete(ctx context.Context, filter any, opts ...options.Lister[options.FindOneAndDeleteOptions]) *mongo.SingleResult
FindOneAndDelete mocks base method.
func (*MockmonCollection) FindOneAndReplace ¶ added in v1.9.0
func (m *MockmonCollection) FindOneAndReplace(ctx context.Context, filter, replacement any, opts ...options.Lister[options.FindOneAndReplaceOptions]) *mongo.SingleResult
FindOneAndReplace mocks base method.
func (*MockmonCollection) FindOneAndUpdate ¶ added in v1.9.0
func (m *MockmonCollection) FindOneAndUpdate(ctx context.Context, filter, update any, opts ...options.Lister[options.FindOneAndUpdateOptions]) *mongo.SingleResult
FindOneAndUpdate mocks base method.
func (*MockmonCollection) Indexes ¶ added in v1.9.0
func (m *MockmonCollection) Indexes() mongo.IndexView
Indexes mocks base method.
func (*MockmonCollection) InsertMany ¶ added in v1.9.0
func (m *MockmonCollection) InsertMany(ctx context.Context, documents any, opts ...options.Lister[options.InsertManyOptions]) (*mongo.InsertManyResult, error)
InsertMany mocks base method.
func (*MockmonCollection) InsertOne ¶ added in v1.9.0
func (m *MockmonCollection) InsertOne(ctx context.Context, document any, opts ...options.Lister[options.InsertOneOptions]) (*mongo.InsertOneResult, error)
InsertOne mocks base method.
func (*MockmonCollection) ReplaceOne ¶ added in v1.9.0
func (m *MockmonCollection) ReplaceOne(ctx context.Context, filter, replacement any, opts ...options.Lister[options.ReplaceOptions]) (*mongo.UpdateResult, error)
ReplaceOne mocks base method.
func (*MockmonCollection) UpdateByID ¶ added in v1.9.0
func (m *MockmonCollection) UpdateByID(ctx context.Context, id, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
UpdateByID mocks base method.
func (*MockmonCollection) UpdateMany ¶ added in v1.9.0
func (m *MockmonCollection) UpdateMany(ctx context.Context, filter, update any, opts ...options.Lister[options.UpdateManyOptions]) (*mongo.UpdateResult, error)
UpdateMany mocks base method.
func (*MockmonCollection) UpdateOne ¶ added in v1.9.0
func (m *MockmonCollection) UpdateOne(ctx context.Context, filter, update any, opts ...options.Lister[options.UpdateOneOptions]) (*mongo.UpdateResult, error)
UpdateOne mocks base method.
func (*MockmonCollection) Watch ¶ added in v1.9.0
func (m *MockmonCollection) Watch(ctx context.Context, pipeline any, opts ...options.Lister[options.ChangeStreamOptions]) (*mongo.ChangeStream, error)
Watch mocks base method.
type MockmonCollectionMockRecorder ¶ added in v1.9.0
type MockmonCollectionMockRecorder struct {
// contains filtered or unexported fields
}
MockmonCollectionMockRecorder is the mock recorder for MockmonCollection.
func (*MockmonCollectionMockRecorder) Aggregate ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Aggregate(ctx, pipeline any, opts ...any) *gomock.Call
Aggregate indicates an expected call of Aggregate.
func (*MockmonCollectionMockRecorder) BulkWrite ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) BulkWrite(ctx, models any, opts ...any) *gomock.Call
BulkWrite indicates an expected call of BulkWrite.
func (*MockmonCollectionMockRecorder) Clone ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Clone(opts ...any) *gomock.Call
Clone indicates an expected call of Clone.
func (*MockmonCollectionMockRecorder) CountDocuments ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) CountDocuments(ctx, filter any, opts ...any) *gomock.Call
CountDocuments indicates an expected call of CountDocuments.
func (*MockmonCollectionMockRecorder) Database ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Database() *gomock.Call
Database indicates an expected call of Database.
func (*MockmonCollectionMockRecorder) DeleteMany ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) DeleteMany(ctx, filter any, opts ...any) *gomock.Call
DeleteMany indicates an expected call of DeleteMany.
func (*MockmonCollectionMockRecorder) DeleteOne ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) DeleteOne(ctx, filter any, opts ...any) *gomock.Call
DeleteOne indicates an expected call of DeleteOne.
func (*MockmonCollectionMockRecorder) Distinct ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Distinct(ctx, fieldName, filter any, opts ...any) *gomock.Call
Distinct indicates an expected call of Distinct.
func (*MockmonCollectionMockRecorder) Drop ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Drop(ctx any, opts ...any) *gomock.Call
Drop indicates an expected call of Drop.
func (*MockmonCollectionMockRecorder) EstimatedDocumentCount ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) EstimatedDocumentCount(ctx any, opts ...any) *gomock.Call
EstimatedDocumentCount indicates an expected call of EstimatedDocumentCount.
func (*MockmonCollectionMockRecorder) Find ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Find(ctx, filter any, opts ...any) *gomock.Call
Find indicates an expected call of Find.
func (*MockmonCollectionMockRecorder) FindOne ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) FindOne(ctx, filter any, opts ...any) *gomock.Call
FindOne indicates an expected call of FindOne.
func (*MockmonCollectionMockRecorder) FindOneAndDelete ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) FindOneAndDelete(ctx, filter any, opts ...any) *gomock.Call
FindOneAndDelete indicates an expected call of FindOneAndDelete.
func (*MockmonCollectionMockRecorder) FindOneAndReplace ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) FindOneAndReplace(ctx, filter, replacement any, opts ...any) *gomock.Call
FindOneAndReplace indicates an expected call of FindOneAndReplace.
func (*MockmonCollectionMockRecorder) FindOneAndUpdate ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) FindOneAndUpdate(ctx, filter, update any, opts ...any) *gomock.Call
FindOneAndUpdate indicates an expected call of FindOneAndUpdate.
func (*MockmonCollectionMockRecorder) Indexes ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) Indexes() *gomock.Call
Indexes indicates an expected call of Indexes.
func (*MockmonCollectionMockRecorder) InsertMany ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) InsertMany(ctx, documents any, opts ...any) *gomock.Call
InsertMany indicates an expected call of InsertMany.
func (*MockmonCollectionMockRecorder) InsertOne ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) InsertOne(ctx, document any, opts ...any) *gomock.Call
InsertOne indicates an expected call of InsertOne.
func (*MockmonCollectionMockRecorder) ReplaceOne ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) ReplaceOne(ctx, filter, replacement any, opts ...any) *gomock.Call
ReplaceOne indicates an expected call of ReplaceOne.
func (*MockmonCollectionMockRecorder) UpdateByID ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) UpdateByID(ctx, id, update any, opts ...any) *gomock.Call
UpdateByID indicates an expected call of UpdateByID.
func (*MockmonCollectionMockRecorder) UpdateMany ¶ added in v1.9.0
func (mr *MockmonCollectionMockRecorder) UpdateMany(ctx, filter, update any, opts ...any) *gomock.Call
UpdateMany indicates an expected call of UpdateMany.
type MockmonSession ¶ added in v1.9.0
type MockmonSession struct {
// contains filtered or unexported fields
}
MockmonSession is a mock of monSession interface.
func NewMockmonSession ¶ added in v1.9.0
func NewMockmonSession(ctrl *gomock.Controller) *MockmonSession
NewMockmonSession creates a new mock instance.
func (*MockmonSession) AbortTransaction ¶ added in v1.9.0
func (m *MockmonSession) AbortTransaction(ctx context.Context) error
AbortTransaction mocks base method.
func (*MockmonSession) CommitTransaction ¶ added in v1.9.0
func (m *MockmonSession) CommitTransaction(ctx context.Context) error
CommitTransaction mocks base method.
func (*MockmonSession) EXPECT ¶ added in v1.9.0
func (m *MockmonSession) EXPECT() *MockmonSessionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockmonSession) EndSession ¶ added in v1.9.0
func (m *MockmonSession) EndSession(ctx context.Context)
EndSession mocks base method.
func (*MockmonSession) WithTransaction ¶ added in v1.9.0
func (m *MockmonSession) WithTransaction(ctx context.Context, fn func(context.Context) (any, error), opts ...options.Lister[options.TransactionOptions]) (any, error)
WithTransaction mocks base method.
type MockmonSessionMockRecorder ¶ added in v1.9.0
type MockmonSessionMockRecorder struct {
// contains filtered or unexported fields
}
MockmonSessionMockRecorder is the mock recorder for MockmonSession.
func (*MockmonSessionMockRecorder) AbortTransaction ¶ added in v1.9.0
func (mr *MockmonSessionMockRecorder) AbortTransaction(ctx any) *gomock.Call
AbortTransaction indicates an expected call of AbortTransaction.
func (*MockmonSessionMockRecorder) CommitTransaction ¶ added in v1.9.0
func (mr *MockmonSessionMockRecorder) CommitTransaction(ctx any) *gomock.Call
CommitTransaction indicates an expected call of CommitTransaction.
func (*MockmonSessionMockRecorder) EndSession ¶ added in v1.9.0
func (mr *MockmonSessionMockRecorder) EndSession(ctx any) *gomock.Call
EndSession indicates an expected call of EndSession.
func (*MockmonSessionMockRecorder) WithTransaction ¶ added in v1.9.0
func (mr *MockmonSessionMockRecorder) WithTransaction(ctx, fn any, opts ...any) *gomock.Call
WithTransaction indicates an expected call of WithTransaction.
type Model ¶
type Model struct {
Collection
// contains filtered or unexported fields
}
Model is a mongodb store model that represents a collection.
func MustNewModel ¶
MustNewModel returns a Model, exits on errors.
func (*Model) Aggregate ¶
func (m *Model) Aggregate(ctx context.Context, v, pipeline any, opts ...options.Lister[options.AggregateOptions]) error
Aggregate executes an aggregation pipeline.
func (*Model) DeleteMany ¶
func (m *Model) DeleteMany(ctx context.Context, filter any, opts ...options.Lister[options.DeleteManyOptions]) (int64, error)
DeleteMany deletes documents that match the filter.
func (*Model) DeleteOne ¶
func (m *Model) DeleteOne(ctx context.Context, filter any, opts ...options.Lister[options.DeleteOneOptions]) (int64, error)
DeleteOne deletes the first document that matches the filter.
func (*Model) Find ¶
func (m *Model) Find(ctx context.Context, v, filter any, opts ...options.Lister[options.FindOptions]) error
Find finds documents that match the filter.
func (*Model) FindOne ¶
func (m *Model) FindOne(ctx context.Context, v, filter any, opts ...options.Lister[options.FindOneOptions]) error
FindOne finds the first document that matches the filter.
func (*Model) FindOneAndDelete ¶
func (m *Model) FindOneAndDelete(ctx context.Context, v, filter any, opts ...options.Lister[options.FindOneAndDeleteOptions]) error
FindOneAndDelete finds a single document and deletes it.
func (*Model) FindOneAndReplace ¶
func (m *Model) FindOneAndReplace(ctx context.Context, v, filter, replacement any, opts ...options.Lister[options.FindOneAndReplaceOptions]) error
FindOneAndReplace finds a single document and replaces it.
func (*Model) FindOneAndUpdate ¶
func (m *Model) FindOneAndUpdate(ctx context.Context, v, filter, update any, opts ...options.Lister[options.FindOneAndUpdateOptions]) error
FindOneAndUpdate finds a single document and updates it.
func (*Model) StartSession ¶
func (m *Model) StartSession(opts ...options.Lister[options.SessionOptions]) (sess *Session, err error)
StartSession starts a new session.
type Option ¶
type Option func(opts *clientOptions)
Option defines the method to customize a mongo model.
func WithTimeout ¶ added in v1.4.4
WithTimeout set the mon client operation timeout.
func WithTypeCodec ¶ added in v1.6.3
WithTypeCodec registers TypeCodecs to convert custom types.
type ResultHandler ¶
type ResultHandler func(*mongo.InsertManyResult, error)
ResultHandler is a handler that used to handle results.
type Session ¶ added in v1.9.0
type Session struct {
// contains filtered or unexported fields
}
func (*Session) AbortTransaction ¶ added in v1.9.0
AbortTransaction implements the mongo.session interface.
func (*Session) CommitTransaction ¶ added in v1.9.0
CommitTransaction implements the mongo.session interface.
func (*Session) EndSession ¶ added in v1.9.0
EndSession implements the mongo.session interface.
type TypeCodec ¶ added in v1.6.3
type TypeCodec struct {
ValueType reflect.Type
Encoder bson.ValueEncoder
Decoder bson.ValueDecoder
}
TypeCodec is a struct that stores specific type Encoder/Decoder.