mirror of https://github.com/jackc/pgx.git
Use ++ instead of += 1
parent
f9ce8af5c9
commit
f18351f61c
|
@ -40,7 +40,7 @@ func (eqb *extendedQueryBuilder) Reset() {
|
||||||
eqb.paramFormats = eqb.paramFormats[0:0]
|
eqb.paramFormats = eqb.paramFormats[0:0]
|
||||||
eqb.resultFormats = eqb.resultFormats[0:0]
|
eqb.resultFormats = eqb.resultFormats[0:0]
|
||||||
|
|
||||||
eqb.resetCount += 1
|
eqb.resetCount++
|
||||||
|
|
||||||
// Every so often shrink our reserved memory if it is abnormally high
|
// Every so often shrink our reserved memory if it is abnormally high
|
||||||
if eqb.resetCount%128 == 0 {
|
if eqb.resetCount%128 == 0 {
|
||||||
|
|
|
@ -108,7 +108,7 @@ func TestPoolBeforeAcquire(t *testing.T) {
|
||||||
acquireAttempts := 0
|
acquireAttempts := 0
|
||||||
|
|
||||||
config.BeforeAcquire = func(ctx context.Context, c *pgx.Conn) bool {
|
config.BeforeAcquire = func(ctx context.Context, c *pgx.Conn) bool {
|
||||||
acquireAttempts += 1
|
acquireAttempts++
|
||||||
return acquireAttempts%2 == 0
|
return acquireAttempts%2 == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ func TestPoolAfterRelease(t *testing.T) {
|
||||||
afterReleaseCount := 0
|
afterReleaseCount := 0
|
||||||
|
|
||||||
config.AfterRelease = func(c *pgx.Conn) bool {
|
config.AfterRelease = func(c *pgx.Conn) bool {
|
||||||
afterReleaseCount += 1
|
afterReleaseCount++
|
||||||
return afterReleaseCount%2 == 1
|
return afterReleaseCount%2 == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
tx.go
2
tx.go
|
@ -140,7 +140,7 @@ func (tx *dbTx) Begin(ctx context.Context) (Tx, error) {
|
||||||
return nil, ErrTxClosed
|
return nil, ErrTxClosed
|
||||||
}
|
}
|
||||||
|
|
||||||
tx.savepointNum += 1
|
tx.savepointNum++
|
||||||
_, err := tx.conn.Exec(ctx, "savepoint sp_"+strconv.FormatInt(tx.savepointNum, 10))
|
_, err := tx.conn.Exec(ctx, "savepoint sp_"+strconv.FormatInt(tx.savepointNum, 10))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue