db

package
v0.0.0-...-d85391b Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ConnectionTimeOut = 10 * time.Second

ConnectionTimeOut - Max time to establish DB connection

Variables

View Source
var (
	InvalidConnUrlErr = errors.New("Failed to connect to DB, as the connection string is invalid")
	ClientCreationErr = errors.New("Failed to create new client to connect with db")
	ClientInitErr     = errors.New("Failed to initialize db client")
	ConnectionLeak    = errors.New("Unable to disconnect from db, potential connection leak")
)

Functions

This section is empty.

Types

type MongoDatabase

type MongoDatabase interface {
	Collection(name string, opts ...*options.CollectionOptions) *mongo.Collection
}

type MongoManager

type MongoManager interface {
	Database() MongoDatabase
	Ping() error
	Disconnect() error
}

func NewMongoManager

func NewMongoManager(dbName, connUrl string) (MongoManager, error)

NewMongoManager - Initializes DB connection and returns a Manager object which can be used to perform DB operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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