Skip to content

Commit

Permalink
feat: add goqu
Browse files Browse the repository at this point in the history
  • Loading branch information
miaolz123 committed Jun 16, 2020
1 parent 81693d5 commit 7162167
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 55 deletions.
4 changes: 4 additions & 0 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strings"
"time"

"github.com/doug-martin/goqu/v9"
_ "github.com/doug-martin/goqu/v9/dialect/mysql"
_ "github.com/go-sql-driver/mysql"
"github.com/gxxgle/go-utils/env"
"github.com/gxxgle/go-utils/log"
Expand All @@ -18,6 +20,7 @@ var (
DefaullRetrySleep = time.Second
DefaultNeedRetry = isDeadlock
Builder func() *builder.Builder
Goqu goqu.DialectWrapper
)

// Config for db
Expand All @@ -36,6 +39,7 @@ func OpenDB(cfg *Config) (*xorm.Engine, error) {
switch cfg.Driver {
case builder.MYSQL:
Builder = builder.MySQL
Goqu = goqu.Dialect(builder.MYSQL)
// case builder.POSTGRES:
// Builder = builder.Postgres
default:
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ module github.com/gxxgle/go-utils
go 1.13

require (
cloud.google.com/go v0.45.1 // indirect
github.com/ajg/form v1.5.1 // indirect
github.com/assembla/cony v0.3.2
github.com/bsm/redislock v0.5.0
github.com/doug-martin/goqu/v9 v9.9.0
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
github.com/go-redis/redis/v7 v7.2.0
github.com/go-sql-driver/mysql v1.5.0
github.com/golang/protobuf v1.3.3 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/google/go-cmp v0.4.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/imroc/req v0.3.0
Expand Down
Loading

0 comments on commit 7162167

Please sign in to comment.