mmongo

package
v1.29.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 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