Use ++ instead of += 1

pull/745/head
Jack Christensen 2020-05-07 20:25:38 -05:00
parent f9ce8af5c9
commit f18351f61c
3 changed files with 4 additions and 4 deletions

View File

@ -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 {

View File

@ -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
View File

@ -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