作者 yangfu

sql 日志

@@ -10,9 +10,6 @@ import ( @@ -10,9 +10,6 @@ import (
10 "github.com/go-pg/pg/v10" 10 "github.com/go-pg/pg/v10"
11 "github.com/go-pg/pg/v10/orm" 11 "github.com/go-pg/pg/v10/orm"
12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
13 -  
14 - //_ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg/models"  
15 - "github.com/linmadan/egglib-go/persistent/pg/hooks"  
16 ) 13 )
17 14
18 var DB *pg.DB 15 var DB *pg.DB
@@ -25,7 +22,7 @@ func init() { @@ -25,7 +22,7 @@ func init() {
25 Addr: fmt.Sprintf("%s:%s", constant.POSTGRESQL_HOST, constant.POSTGRESQL_PORT), 22 Addr: fmt.Sprintf("%s:%s", constant.POSTGRESQL_HOST, constant.POSTGRESQL_PORT),
26 }) 23 })
27 if !constant.DISABLE_SQL_GENERATE_PRINT { 24 if !constant.DISABLE_SQL_GENERATE_PRINT {
28 - DB.AddQueryHook(hooks.SqlGeneratePrintHook{}) 25 + DB.AddQueryHook(SqlGeneratePrintHook{})
29 } 26 }
30 if !constant.DISABLE_CREATE_TABLE { 27 if !constant.DISABLE_CREATE_TABLE {
31 for _, model := range []interface{}{ 28 for _, model := range []interface{}{
@@ -6,11 +6,11 @@ import ( @@ -6,11 +6,11 @@ import (
6 "github.com/linmadan/egglib-go/log" 6 "github.com/linmadan/egglib-go/log"
7 "github.com/linmadan/egglib-go/web/beego/filters" 7 "github.com/linmadan/egglib-go/web/beego/filters"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/constant"
9 - "os"  
10 - "strconv"  
11 -  
12 . "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log" 9 . "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
  10 + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/log"
13 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/routers" 11 _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/port/beego/routers"
  12 + "os"
  13 + "strconv"
14 ) 14 )
15 15
16 func init() { 16 func init() {