File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
13
13
"database/sql"
14
14
"errors"
15
15
16
+ "github.com/jmoiron/sqlx"
16
17
"golang.org/x/xerrors"
17
18
)
18
19
@@ -36,7 +37,7 @@ type DBTX interface {
36
37
func New (sdb * sql.DB ) Store {
37
38
return & sqlQuerier {
38
39
db : sdb ,
39
- sdb : sdb ,
40
+ sdb : sqlx . NewDb ( sdb , "postgres" ) ,
40
41
}
41
42
}
42
43
@@ -48,13 +49,13 @@ type querier interface {
48
49
}
49
50
50
51
type sqlQuerier struct {
51
- sdb * sql .DB
52
+ sdb * sqlx .DB
52
53
db DBTX
53
54
}
54
55
55
56
// InTx performs database operations inside a transaction.
56
57
func (q * sqlQuerier ) InTx (function func (Store ) error ) error {
57
- if _ , ok := q .db .(* sql .Tx ); ok {
58
+ if _ , ok := q .db .(* sqlx .Tx ); ok {
58
59
// If the current inner "db" is already a transaction, we just reuse it.
59
60
// We do not need to handle commit/rollback as the outer tx will handle
60
61
// that.
You can’t perform that action at this time.
0 commit comments