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
Click to show internal directories.
Click to hide internal directories.