Documentation ¶
Index ¶
- func NewDatabaseMock(coll mongo.Collection) mongo.Database
- func NewStorageMock(uri string, client mongo.Client) *mongo.Storage
- type ClientMock
- type CollectionMock
- func (m *CollectionMock) Count(ctx context.Context, filter interface{}) (int64, error)
- func (m *CollectionMock) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (mongo.Cursor, error)
- func (m *CollectionMock) FindOne(ctx context.Context, filter interface{}) mongo.SingleResult
- func (m *CollectionMock) InsertOne(ctx context.Context, document interface{}) (*mongodb.InsertOneResult, error)
- type CursorMock
- type DatabaseMock
- type SingleResultMock
- type StorageMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseMock ¶
func NewDatabaseMock(coll mongo.Collection) mongo.Database
Types ¶
type ClientMock ¶
func NewClientMock ¶
func (*ClientMock) Disconnect ¶
func (m *ClientMock) Disconnect(ctx context.Context) error
type CollectionMock ¶
type CollectionMock struct { Value interface{} Err error }
func NewCollectionMock ¶
func NewCollectionMock(value interface{}, err error) *CollectionMock
func (*CollectionMock) Count ¶
func (m *CollectionMock) Count(ctx context.Context, filter interface{}) (int64, error)
func (*CollectionMock) Find ¶
func (m *CollectionMock) Find(ctx context.Context, filter interface{}, opts ...*options.FindOptions) (mongo.Cursor, error)
func (*CollectionMock) FindOne ¶
func (m *CollectionMock) FindOne(ctx context.Context, filter interface{}) mongo.SingleResult
func (*CollectionMock) InsertOne ¶
func (m *CollectionMock) InsertOne(ctx context.Context, document interface{}) (*mongodb.InsertOneResult, error)
type CursorMock ¶
type CursorMock struct { Cursor int Current interface{} Values interface{} Error error // contains filtered or unexported fields }
func NewCursorMock ¶
func NewCursorMock(values interface{}, err error) *CursorMock
func (*CursorMock) Decode ¶
func (m *CursorMock) Decode(v interface{}) error
func (*CursorMock) Err ¶
func (m *CursorMock) Err() error
func (*CursorMock) Len ¶
func (m *CursorMock) Len() int64
type DatabaseMock ¶
type DatabaseMock struct {
Coll mongo.Collection
}
func (*DatabaseMock) Collection ¶
func (m *DatabaseMock) Collection(name string) mongo.Collection
type SingleResultMock ¶
func (*SingleResultMock) Decode ¶
func (m *SingleResultMock) Decode(v interface{}) error
type StorageMock ¶
func (*StorageMock) WithCollection ¶
func (m *StorageMock) WithCollection(collection *CollectionMock) *StorageMock
func (*StorageMock) WithDatabase ¶
func (m *StorageMock) WithDatabase(database *DatabaseMock) *StorageMock
Click to show internal directories.
Click to hide internal directories.