Skip to content

Commit

Permalink
fix: parsing and assignment of statementTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Dombo committed Jul 26, 2022
1 parent d6b843a commit f3b5825
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions database/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import (
"crypto/x509"
"database/sql"
"fmt"
"go.uber.org/atomic"
"io"
"io/ioutil"
nurl "net/url"
"strconv"
"strings"
"time"

"go.uber.org/atomic"

"github.com/go-sql-driver/mysql"
"github.com/golang-migrate/migrate/v4/database"
"github.com/hashicorp/go-multierror"
Expand Down Expand Up @@ -246,7 +247,7 @@ func (m *Mysql) Open(url string) (database.Driver, error) {
statementTimeoutParam := customParams["x-statement-timeout"]
statementTimeout := 0
if statementTimeoutParam != "" {
statementTimeout, err := strconv.ParseFloat(statementTimeoutParam, 64)
statementTimeout, err = strconv.Atoi(statementTimeoutParam)
if err != nil {
return nil, fmt.Errorf("could not parse x-statement-timeout as float: %w", err)
}
Expand Down

0 comments on commit f3b5825

Please sign in to comment.