Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( User string = os.Getenv("MONGODB_USERNAME") Password string = os.Getenv("MONGODB_PASSWORD") Host string = os.Getenv("MONGODB_HOST") Database string = os.Getenv("MONGODB_DATABASE") Port int = 27017 )
Connection details from env vars or a .env file
Functions ¶
func PanicRecoverHandler ¶
func PanicRecoverHandler(err error)
Just a basic panic recover that can be used in a defer somewhere
Types ¶
type MongoCollection ¶
type MongoConnector ¶
type MongoConnector struct {
// contains filtered or unexported fields
}
Basic structure to hold the connection
func (*MongoConnector) Connect ¶
func (d *MongoConnector) Connect() error
Connect to mongo and set up the structure with an active connection
func (*MongoConnector) Disconnect ¶
func (d *MongoConnector) Disconnect() error
Disconnect from mongo (should you ever want to)
func (*MongoConnector) GetCollection ¶
func (d *MongoConnector) GetCollection(name string) *mongo.Collection
return the collection from the active connection
Click to show internal directories.
Click to hide internal directories.