Skip to content

Commit be1b3a5

Browse files
authored
expose client.DB (#93)
1 parent 1d62b5a commit be1b3a5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build: fmt
99
go build -ldflags "-X github.com/swiftcarrot/queryx/cmd/queryx/action.Version=`git rev-parse HEAD`" -o bin/queryx cmd/queryx/main.go
1010

1111
install: build
12-
install bin/queryx /usr/local/bin
12+
sudo install bin/queryx /usr/local/bin
1313

1414
clean:
1515
rm bin/queryx
@@ -21,9 +21,9 @@ test-postgresql: install
2121
cd internal/integration && queryx db:migrate --schema postgresql.hcl
2222
cd internal/integration && queryx db:migrate --schema postgresql.hcl
2323
cd internal/integration && queryx generate --schema postgresql.hcl
24-
cd internal/integration && yarn tsc
25-
cd internal/integration && yarn test
26-
# cd internal/integration && go test ./...
24+
# cd internal/integration && yarn tsc
25+
# cd internal/integration && yarn test
26+
cd internal/integration && go test ./...
2727
# cd internal/integration && queryx db:drop --schema postgresql.hcl
2828

2929
test-mysql: install

generator/client/golang/templates/queryx.gotmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type Queries interface {
1919
}
2020

2121
type QXClient struct {
22-
db *sql.DB
22+
DB *sql.DB
2323
config *queryx.Config
2424
logger queryx.Logger
2525
*queryx.Adapter
@@ -52,12 +52,12 @@ func NewClientWithEnv(env string) (*QXClient, error) {
5252
}
5353

5454
client := &QXClient{
55-
db: db,
55+
DB: db,
5656
config: config,
5757
Adapter: queryx.NewAdapter(db),
5858
Schema : queryx.NewSchema(),
5959
}
60-
client.setDefaultLogger()
60+
client.setDefaultLogger()
6161

6262
return client, nil
6363
}
@@ -102,7 +102,7 @@ type Tx struct {
102102

103103
func (c *QXClient) Tx() (*Tx, error) {
104104
ctx := context.Background()
105-
tx, err := c.db.BeginTx(ctx, nil)
105+
tx, err := c.DB.BeginTx(ctx, nil)
106106
if err != nil {
107107
return nil, err
108108
}

0 commit comments

Comments
 (0)