xmongo

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertMongoError

func ConvertMongoError(err error, entity string, keyFmt string, args ...interface{}) error

func ConvertSortOptionsToMongo

func ConvertSortOptionsToMongo(defaultField string, defaultDirection xpaging.SortDirection, options xpaging.SortOptions) bson.D

func CreateIndexes

func CreateIndexes(logger xlogger.Logger, collection *mongo.Collection, models ...mongo.IndexModel)

CreateIndexes creates one or more indexes in the provided collection reporting the result in the log

Types

type MongoInMemory

type MongoInMemory struct {
	// contains filtered or unexported fields
}

MongoInMemory allows to start a MongoDB instance in memory to run tests against To use it, create a new instance of MongoInMemory and call Connect() before running your tests and call Disconnect() after your tests are done. The client to connect to MongoDB can be retrieved by calling Client().

func (*MongoInMemory) Client

func (m *MongoInMemory) Client() *mongo.Client

func (*MongoInMemory) Connect

func (m *MongoInMemory) Connect()

func (*MongoInMemory) Disconnect

func (m *MongoInMemory) Disconnect()

Jump to

Keyboard shortcuts

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