db connect
This commit is contained in:
10
handler.go
10
handler.go
@@ -15,7 +15,7 @@ import (
|
||||
func (api *API) collectionGetOneHandler(m mgocrud.ModelInterface) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
session := api.DBSession.Copy()
|
||||
session := api.DBConnection.NewSession()
|
||||
defer session.Close()
|
||||
db := session.DB(api.DBName)
|
||||
|
||||
@@ -79,7 +79,7 @@ func (api *API) collectionGetHandler(m mgocrud.ModelInterface) gin.HandlerFunc {
|
||||
|
||||
results := x.Interface()
|
||||
|
||||
session := api.DBSession.Copy()
|
||||
session := api.DBConnection.NewSession()
|
||||
defer session.Close()
|
||||
db := session.DB(api.DBName)
|
||||
|
||||
@@ -205,7 +205,7 @@ func (api *API) collectionPostHandler(m mgocrud.ModelInterface) gin.HandlerFunc
|
||||
return
|
||||
}
|
||||
|
||||
session := api.DBSession.Copy()
|
||||
session := api.DBConnection.NewSession()
|
||||
defer session.Close()
|
||||
db := session.DB(api.DBName)
|
||||
|
||||
@@ -257,7 +257,7 @@ func (api *API) collectionPostHandler(m mgocrud.ModelInterface) gin.HandlerFunc
|
||||
|
||||
func (api *API) collectionPutHandler(m mgocrud.ModelInterface) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
session := api.DBSession.Copy()
|
||||
session := api.DBConnection.NewSession()
|
||||
defer session.Close()
|
||||
db := session.DB(api.DBName)
|
||||
|
||||
@@ -399,7 +399,7 @@ func (api *API) collectionPutHandler(m mgocrud.ModelInterface) gin.HandlerFunc {
|
||||
func (api *API) collectionDeleteHandler(m mgocrud.ModelInterface) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
session := api.DBSession.Copy()
|
||||
session := api.DBConnection.NewSession()
|
||||
defer session.Close()
|
||||
db := session.DB(api.DBName)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user