Documentation ¶
Index ¶
- Variables
- func MockCursor(objs ...interface{}) (*mongo.Cursor, error)
- func MockSingleResult(obj interface{}) (*mongo.SingleResult, error)
- type MockCollection
- func (m *MockCollection) CountDocuments(ctx context.Context, filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (m *MockCollection) DeleteMany(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *MockCollection) DeleteOne(ctx context.Context, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *MockCollection) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func (m *MockCollection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (m *MockCollection) FindOneAndReplace(ctx context.Context, filter interface{}, replacement interface{}, ...) *mongo.SingleResult
- func (m *MockCollection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (m *MockCollection) UpdateMany(ctx context.Context, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
- func (m *MockCollection) UpdateOne(ctx context.Context, filter interface{}, update interface{}, ...) (*mongo.UpdateResult, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var MockWriteException = mongo.WriteException{ WriteErrors: mongo.WriteErrors{ mongo.WriteError{ Code: 11000, }, }, }
Functions ¶
func MockCursor ¶
func MockSingleResult ¶
func MockSingleResult(obj interface{}) (*mongo.SingleResult, error)
Types ¶
type MockCollection ¶
type MockCollection struct { CountDocumentsFn func( ctx context.Context, filter interface{}, opts ...*options.CountOptions, ) (int64, error) DeleteManyFn func( ctx context.Context, filter interface{}, opts ...*options.DeleteOptions, ) (*mongo.DeleteResult, error) DeleteOneFn func( ctx context.Context, filter interface{}, opts ...*options.DeleteOptions, ) (*mongo.DeleteResult, error) FindFn func( ctx context.Context, filter interface{}, opts ...*options.FindOptions, ) (*mongo.Cursor, error) FindOneFn func( ctx context.Context, filter interface{}, opts ...*options.FindOneOptions, ) *mongo.SingleResult FindOneAndReplaceFn func( ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions, ) *mongo.SingleResult InsertOneFn func( ctx context.Context, document interface{}, opts ...*options.InsertOneOptions, ) (*mongo.InsertOneResult, error) UpdateManyFn func( ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (*mongo.UpdateResult, error) UpdateOneFn func( ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (*mongo.UpdateResult, error) }
func (*MockCollection) CountDocuments ¶
func (m *MockCollection) CountDocuments( ctx context.Context, filter interface{}, opts ...*options.CountOptions, ) (int64, error)
func (*MockCollection) DeleteMany ¶
func (m *MockCollection) DeleteMany( ctx context.Context, filter interface{}, opts ...*options.DeleteOptions, ) (*mongo.DeleteResult, error)
func (*MockCollection) DeleteOne ¶
func (m *MockCollection) DeleteOne( ctx context.Context, filter interface{}, opts ...*options.DeleteOptions, ) (*mongo.DeleteResult, error)
func (*MockCollection) Find ¶
func (m *MockCollection) Find( ctx context.Context, filter interface{}, opts ...*options.FindOptions, ) (*mongo.Cursor, error)
func (*MockCollection) FindOne ¶
func (m *MockCollection) FindOne( ctx context.Context, filter interface{}, opts ...*options.FindOneOptions, ) *mongo.SingleResult
func (*MockCollection) FindOneAndReplace ¶
func (m *MockCollection) FindOneAndReplace( ctx context.Context, filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions, ) *mongo.SingleResult
func (*MockCollection) InsertOne ¶
func (m *MockCollection) InsertOne( ctx context.Context, document interface{}, opts ...*options.InsertOneOptions, ) (*mongo.InsertOneResult, error)
func (*MockCollection) UpdateMany ¶
func (m *MockCollection) UpdateMany( ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (*mongo.UpdateResult, error)
func (*MockCollection) UpdateOne ¶
func (m *MockCollection) UpdateOne( ctx context.Context, filter interface{}, update interface{}, opts ...*options.UpdateOptions, ) (*mongo.UpdateResult, error)
Click to show internal directories.
Click to hide internal directories.