database

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoFactory

type MongoFactory struct {
	Client      *mongo.Client
	Database    *mongo.Database
	Context     *executionctx.Context
	DatabaseCxt *database.DatabaseCtx
	Logger      *log.Logger
}

MongoFactory MongoFactory Entity

func NewFactory

func NewFactory(connectionString string) *MongoFactory

NewFactory Instantiate a new MongoDb Factory

func (*MongoFactory) Find

func (f *MongoFactory) Find(collectionName string, filter bson.D) []*bson.M

Find Finds documents in the database

func (*MongoFactory) GetClient

func (f *MongoFactory) GetClient() *mongo.Client

GetClient returns mongodb client

func (*MongoFactory) GetContext

func (f *MongoFactory) GetContext() *executionctx.Context

GetContext Gets the Execution context

func (*MongoFactory) GetDatabase

func (f *MongoFactory) GetDatabase() *mongo.Database

GetDatabase returns MongoDb database

func (*MongoFactory) InsertMany

func (f *MongoFactory) InsertMany(collectionName string, elements []interface{}) *mongo.InsertManyResult

InsertMany Inserts one document into the selected collection

func (*MongoFactory) InsertOne

func (f *MongoFactory) InsertOne(collectionName string, element interface{}) *mongo.InsertOneResult

InsertOne Inserts one document into the selected collection

func (*MongoFactory) WithDatabase

func (f *MongoFactory) WithDatabase(databaseName string) *MongoFactory

Jump to

Keyboard shortcuts

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