Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { CollectionFn CollectionFunc CollectionInvoked bool }
Client is a mock implementation of database.Client.
func ClientMock ¶
ClientMock returns a basic mock for the entire database.
func (Client) Collection ¶
func (c Client) Collection(name string) database.Collection
Collection returns a Collection mock and marks the function as invoked.
type Collection ¶
type Collection struct { FindOneFn FindOneFunc FindOneInvoked bool InsertOneFn func(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (interface{}, error) InsertOneInvoked bool }
Collection is a mock implementation of database.Collection.
func (Collection) FindOne ¶
func (c Collection) FindOne(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) database.SingleResult
FindOne invokes the mock implementation and marks the function as invoked.
func (Collection) InsertOne ¶
func (c Collection) InsertOne(ctx context.Context, document interface{}, opts ...*options.InsertOneOptions) (interface{}, error)
InsertOne invokes the mock implementation and marks the function as invoked.
type CollectionFunc ¶
type CollectionFunc func(name string) database.Collection
CollectionFunc is the function signature for Collection.
type FindOneFunc ¶
type FindOneFunc func(ctx context.Context, filter interface{}, opts ...*options.FindOneOptions) database.SingleResult
FindOneFunc is the function signature for FindOne.
type SingleResult ¶
SingleResult is a mock implementation of database.SingleResult.
func (SingleResult) Decode ¶
func (sr SingleResult) Decode(v interface{}) error
Decode will unmarshal the document represented by this SingleResult into v.