use sqlx for testing connection

This commit is contained in:
c9s 2021-02-17 17:35:47 +08:00
parent e7ef1d3b73
commit b2bcd3528c
2 changed files with 2 additions and 8 deletions

View File

@ -1,6 +0,0 @@
package bbgo
import (
// register the go migrations
_ "github.com/c9s/bbgo/pkg/migrations"
)

View File

@ -2,13 +2,13 @@ package server
import (
"context"
"database/sql"
"net/http"
"os"
"syscall"
"time"
"github.com/gin-gonic/gin"
"github.com/jmoiron/sqlx"
"github.com/sirupsen/logrus"
"github.com/c9s/bbgo/pkg/bbgo"
@ -35,7 +35,7 @@ func (s *Server) setupTestDB(c *gin.Context) {
return
}
db, err := sql.Open(payload.Driver, payload.DSN)
db, err := sqlx.Connect(payload.Driver, payload.DSN)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return