|
@@ -7,6 +7,7 @@ import ( |
|
@@ -7,6 +7,7 @@ import ( |
7
|
"github.com/go-pg/pg/v10/orm"
|
7
|
"github.com/go-pg/pg/v10/orm"
|
8
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
|
8
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
|
9
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
|
9
|
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
|
|
|
10
|
+ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
|
10
|
)
|
11
|
)
|
11
|
|
12
|
|
12
|
var DB *pg.DB
|
13
|
var DB *pg.DB
|
|
@@ -49,6 +50,7 @@ func (hook SqlGeneratePrintHook) BeforeQuery(c context.Context, q *pg.QueryEvent |
|
@@ -49,6 +50,7 @@ func (hook SqlGeneratePrintHook) BeforeQuery(c context.Context, q *pg.QueryEvent |
49
|
|
50
|
|
50
|
func (hook SqlGeneratePrintHook) AfterQuery(c context.Context, q *pg.QueryEvent) error {
|
51
|
func (hook SqlGeneratePrintHook) AfterQuery(c context.Context, q *pg.QueryEvent) error {
|
51
|
data, err := q.FormattedQuery()
|
52
|
data, err := q.FormattedQuery()
|
52
|
- fmt.Println(string(data))
|
53
|
+ //fmt.Println(string(data))
|
|
|
54
|
+ log.Debug(string(data))
|
53
|
return err
|
55
|
return err
|
54
|
} |
56
|
} |