Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MongoDb = ConnectToDb()
Functions ¶
func ConnectToDb ¶
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 ¶
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 ¶
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.