forked from gobuffalo/pop
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdb.go
More file actions
42 lines (32 loc) · 701 Bytes
/
db.go
File metadata and controls
42 lines (32 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package pop
import (
"context"
"database/sql"
"github.com/jackc/pgx/v5/pgxpool"
"github.com/jmoiron/sqlx"
)
type dB struct {
*sqlx.DB
p *pgxpool.Pool
}
func (db *dB) SQLDB() *sql.DB {
return db.DB.DB
}
func (db *dB) PGXPool() *pgxpool.Pool {
return db.p
}
func (db *dB) TransactionContext(ctx context.Context) (*Tx, error) {
return newTX(ctx, db, db.p, nil)
}
func (db *dB) Transaction() (*Tx, error) {
return newTX(context.Background(), db, db.p, nil)
}
func (db *dB) TransactionContextOptions(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
return newTX(ctx, db, db.p, opts)
}
func (db *dB) Rollback() error {
return nil
}
func (db *dB) Commit() error {
return nil
}