middlewares/middlewares.go
func Connect(c *gin.Context) {
	s := db.Session.Clone()

	defer s.Close()

	c.Set("db", s.DB(db.Mongo.Database))
	c.Next()
}
func Connect(c *gin.Context) {
	s := db.Session.Clone()

	defer s.Close()

	c.Set("db", s.DB(db.Mongo.Database))
	c.Next()
}
func Connect ( c * gin . Context ) { s := db . Session . Clone ( ) defer s . Close ( ) c . Set ( " " , s . DB ( db . Mongo . Database ) ) c . Next ( ) }
// Connect middleware clones the database session for each request and
// makes the `db` object available for each handler
Connect middleware clones the database session for each request and makes the db object available for each handler