mocks

package
v0.0.0-...-34d00ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

type MockClient struct {
	*mongo.Client
	Context context.Context

	DatabaseFn func(name string) domain.DataLayer
	CtxFn      func() context.Context
}

MockClient ..

func (MockClient) Ctx

func (c MockClient) Ctx() context.Context

Ctx ..

func (MockClient) Database

func (c MockClient) Database(name string) domain.DataLayer

Database ..

type MockCollection

type MockCollection struct {
	*mongo.Collection

	FindFn func(ctx context.Context,
		i interface{},
	) (domain.Cursor, error)

	InsertOneFn func(
		ctx context.Context,
		i interface{},
	) (domain.MongoInsert, error)

	UpdateOneFn func(
		ctx context.Context,
		filter bson.M,
		i interface{},
	) (domain.MongoUpdate, error)

	DeleteOneFn func(
		ctx context.Context,
		filter bson.M,
	) (domain.MongoDelete, error)
}

MockCollection ..

func (MockCollection) DeleteOne

func (c MockCollection) DeleteOne(
	ctx context.Context,
	filter bson.M,
) (domain.MongoDelete, error)

DeleteOne ..

func (MockCollection) Find

func (c MockCollection) Find(
	ctx context.Context,
	i interface{},
) (domain.Cursor, error)

Find ..

func (MockCollection) InsertOne

func (c MockCollection) InsertOne(
	ctx context.Context,
	i interface{},
) (domain.MongoInsert, error)

InsertOne ..

func (MockCollection) UpdateOne

func (c MockCollection) UpdateOne(
	ctx context.Context,
	filter bson.M,
	i interface{},
) (domain.MongoUpdate, error)

UpdateOne ..

type MockCursor

type MockCursor struct {
	mongo.Cursor

	NextFn         func(ctx context.Context) bool
	CloseFn        func(ctx context.Context) error
	DecodeFn       func(i interface{}) error
	DecodeCursorFn func() (map[string]interface{}, error)
}

MockCursor ..

func (MockCursor) Close

func (c MockCursor) Close(ctx context.Context) error

Close ..

func (MockCursor) Decode

func (c MockCursor) Decode(i interface{}) error

Decode ..

func (MockCursor) DecodeCursor

func (c MockCursor) DecodeCursor() (map[string]interface{}, error)

DecodeCursor ..

func (MockCursor) Next

func (c MockCursor) Next(ctx context.Context) bool

Next ..

type MockDatabase

type MockDatabase struct {
	*mongo.Database

	CollectionFn func(name string) domain.Entities
}

MockDatabase ..

func (MockDatabase) Collection

func (c MockDatabase) Collection(name string) domain.Entities

Collection ..

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL