configs

package
v0.0.0-...-bd01350 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MongoDb = ConnectToDb()

Functions

func ConnectToDb

func ConnectToDb() *mongo.Client

ConnectToDb function will be used to connect to MongoDB. If there is some error than app will panic and shutdown. If there is no error than this function will return MongoDB Client Object

func GetApplicationPort

func GetApplicationPort() string

func GetCollection

func GetCollection(database *mongo.Database, collectionName string) *mongo.Collection

GetCollection function accepts pointer to MongoDB Database object and Collection Name as string It will return pointer to MongoDB Collection object TODO - Check what happens if Collection doesn't exists?

func GetDatabase

func GetDatabase(dbClient *mongo.Client, databaseName string) *mongo.Database

GetDatabase function accepts pointer to MongoDB Client and Database Name as string to which app should connect It will return pointer to MongoDB Database object TODO - Check what happens if Database itself doesn't exists?

func GetEnvMongoLink() string

GetEnvMongoLink function loads the environment variables mentioned in .env file.

While loading variables informtion if there was any error it will panic and stop execution from there. Otherwise, it will fetch MongoDB Connection URL and return to the caller.

Types

This section is empty.

Jump to

Keyboard shortcuts

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