Skip to content

Commit 8c3ee6a

Browse files
committed
Revert "remove sqlx"
This reverts commit 1f4ceee.
1 parent 131d5ed commit 8c3ee6a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

coderd/database/db.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"database/sql"
1414
"errors"
1515

16+
"github.com/jmoiron/sqlx"
1617
"golang.org/x/xerrors"
1718
)
1819

@@ -36,7 +37,7 @@ type DBTX interface {
3637
func New(sdb *sql.DB) Store {
3738
return &sqlQuerier{
3839
db: sdb,
39-
sdb: sdb,
40+
sdb: sqlx.NewDb(sdb, "postgres"),
4041
}
4142
}
4243

@@ -48,13 +49,13 @@ type querier interface {
4849
}
4950

5051
type sqlQuerier struct {
51-
sdb *sql.DB
52+
sdb *sqlx.DB
5253
db DBTX
5354
}
5455

5556
// InTx performs database operations inside a transaction.
5657
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 {
5859
// If the current inner "db" is already a transaction, we just reuse it.
5960
// We do not need to handle commit/rollback as the outer tx will handle
6061
// that.

0 commit comments

Comments
 (0)