From 980c87ff8a5255668d91bc3158d3f219090268e0 Mon Sep 17 00:00:00 2001 From: Michael Li Date: Mon, 20 Mar 2023 19:24:49 +0800 Subject: [PATCH] remove sqlx relate file in gorm mode --- go.mod | 1 - go.sum | 2 -- internal/conf/db_sqlx.go | 30 ------------------------------ 3 files changed, 33 deletions(-) delete mode 100644 internal/conf/db_sqlx.go diff --git a/go.mod b/go.mod index c71ccaf3..15f3e205 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,6 @@ require ( github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang-migrate/migrate/v4 v4.15.2 github.com/huaweicloud/huaweicloud-sdk-go-obs v3.22.11+incompatible - github.com/jmoiron/sqlx v1.3.5 github.com/json-iterator/go v1.1.12 github.com/meilisearch/meilisearch-go v0.21.0 github.com/minio/minio-go/v7 v7.0.49 diff --git a/go.sum b/go.sum index be60077e..17a229a5 100644 --- a/go.sum +++ b/go.sum @@ -796,8 +796,6 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jmoiron/sqlx v1.3.1/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= -github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= -github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= diff --git a/internal/conf/db_sqlx.go b/internal/conf/db_sqlx.go deleted file mode 100644 index a8b1cee4..00000000 --- a/internal/conf/db_sqlx.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2023 ROC. All rights reserved. -// Use of this source code is governed by a MIT style -// license that can be found in the LICENSE file. - -package conf - -import ( - "sync" - - "github.com/jmoiron/sqlx" - "github.com/rocboss/paopao-ce/pkg/naming" - "github.com/sirupsen/logrus" -) - -var ( - _sqlxdb *sqlx.DB - _onceSqlx sync.Once -) - -func MustSqlxDB() *sqlx.DB { - _onceSqlx.Do(func() { - driver, db, err := newSqlDB() - if err != nil { - logrus.Fatalf("new sqlx db failed: %s", err) - } - _sqlxdb = sqlx.NewDb(db, driver) - _sqlxdb.MapperFunc(naming.NewSnakeNamingStrategy().Naming) - }) - return _sqlxdb -}