From b2bcd3528c00237d975c9e368a8fac85040cf05c Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 17 Feb 2021 17:35:47 +0800 Subject: [PATCH] use sqlx for testing connection --- pkg/bbgo/db.go | 6 ------ pkg/server/setup.go | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 pkg/bbgo/db.go diff --git a/pkg/bbgo/db.go b/pkg/bbgo/db.go deleted file mode 100644 index dcdb0eaec..000000000 --- a/pkg/bbgo/db.go +++ /dev/null @@ -1,6 +0,0 @@ -package bbgo - -import ( - // register the go migrations - _ "github.com/c9s/bbgo/pkg/migrations" -) diff --git a/pkg/server/setup.go b/pkg/server/setup.go index 3c9f118c9..03cf7e445 100644 --- a/pkg/server/setup.go +++ b/pkg/server/setup.go @@ -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