mmongo

package
v1.41.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MongoConnection

type MongoConnection struct {
	ConnectionStringSource string
	DB                     *mongo.Client
	Connected              bool
	Database               string
	Logger                 mlog.Logger
}

MongoConnection is a hub which deal with mongodb connections.

func (*MongoConnection) Connect

func (mc *MongoConnection) Connect(ctx context.Context) error

Connect keeps a singleton connection with mongodb.

func (*MongoConnection) GetDB

func (mc *MongoConnection) GetDB(ctx context.Context) (*mongo.Client, error)

GetDB returns a pointer to the mongodb connection, initializing it if necessary.

Jump to

Keyboard shortcuts

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