Skip to content

Commit

Permalink
Merge branch 'master' into add-beforeconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed Feb 5, 2024
2 parents ef007e0 + f019727 commit f07a0be
Show file tree
Hide file tree
Showing 12 changed files with 338 additions and 186 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -96,7 +96,7 @@ jobs:
- name: test
run: |
go test -v '-race' '-covermode=atomic' '-coverprofile=coverage.out'
go test -v '-race' '-covermode=atomic' '-coverprofile=coverage.out' -parallel 10
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
Expand Down
6 changes: 4 additions & 2 deletions AUTHORS
Expand Up @@ -21,6 +21,7 @@ Animesh Ray <mail.rayanimesh at gmail.com>
Arne Hormann <arnehormann at gmail.com>
Ariel Mashraki <ariel at mashraki.co.il>
Asta Xie <xiemengjun at gmail.com>
Brian Hendriks <brian at dolthub.com>
Bulat Gaifullin <gaifullinbf at gmail.com>
Caine Jette <jette at alum.mit.edu>
Carlos Nieto <jose.carlos at menteslibres.net>
Expand Down Expand Up @@ -55,6 +56,7 @@ Jason Ng <oblitorum at gmail.com>
Jean-Yves Pellé <jy at pelle.link>
Jeff Hodges <jeff at somethingsimilar.com>
Jeffrey Charles <jeffreycharles at gmail.com>
Jennifer Purevsuren <jennifer at dolthub.com>
Jerome Meyer <jxmeyer at gmail.com>
Jiajia Zhong <zhong2plus at gmail.com>
Jian Zhen <zhenjl at gmail.com>
Expand Down Expand Up @@ -84,6 +86,7 @@ Oliver Bone <owbone at github.com>
Olivier Mengué <dolmen at cpan.org>
oscarzhao <oscarzhaosl at gmail.com>
Paul Bonser <misterpib at gmail.com>
Paulius Lozys <pauliuslozys at gmail.com>
Peter Schultz <peter.schultz at classmarkets.com>
Phil Porada <philporada at gmail.com>
Rebecca Chin <rchin at pivotal.io>
Expand Down Expand Up @@ -116,13 +119,13 @@ Zhang Xiang <angwerzx at 126.com>
Zhenye Xie <xiezhenye at gmail.com>
Zhixin Wen <john.wenzhixin at gmail.com>
Ziheng Lyu <zihenglv at gmail.com>
Brian Hendriks <brian at dolthub.com>

# Organizations

Barracuda Networks, Inc.
Counting Ltd.
DigitalOcean Inc.
Dolthub Inc.
dyves labs AG
Facebook Inc.
GitHub Inc.
Expand All @@ -137,4 +140,3 @@ Pivotal Inc.
Shattered Silicon Ltd.
Stripe Inc.
Zendesk Inc.
Dolthub Inc.
21 changes: 19 additions & 2 deletions README.md
Expand Up @@ -40,8 +40,16 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
* Optional placeholder interpolation

## Requirements
* Go 1.18 or higher. We aim to support the 3 latest versions of Go.
* MySQL (5.6+), MariaDB, Percona Server, Google CloudSQL or Sphinx (2.2.3+)

* Go 1.19 or higher. We aim to support the 3 latest versions of Go.
* MySQL (5.7+) and MariaDB (10.3+) are supported.
* [TiDB](https://github.com/pingcap/tidb) is supported by PingCAP.
* Do not ask questions about TiDB in our issue tracker or forum.
* [Document](https://docs.pingcap.com/tidb/v6.1/dev-guide-sample-application-golang)
* [Forum](https://ask.pingcap.com/)
* go-mysql would work with Percona Server, Google CloudSQL or Sphinx (2.2.3+).
* Maintainers won't support them. Do not expect issues are investigated and resolved by maintainers.
* Investigate issues yourself and please send a pull request to fix it.

---------------------------------------

Expand Down Expand Up @@ -285,6 +293,15 @@ Note that this sets the location for time.Time values but does not change MySQL'

Please keep in mind, that param values must be [url.QueryEscape](https://golang.org/pkg/net/url/#QueryEscape)'ed. Alternatively you can manually replace the `/` with `%2F`. For example `US/Pacific` would be `loc=US%2FPacific`.

##### `timeTruncate`

```
Type: duration
Default: 0
```

[Truncate time values](https://pkg.go.dev/time#Duration.Truncate) to the specified duration. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.

##### `maxAllowedPacket`
```
Type: decimal number
Expand Down
2 changes: 1 addition & 1 deletion conncheck_test.go
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestStaleConnectionChecks(t *testing.T) {
runTests(t, dsn, func(dbt *DBTest) {
runTestsParallel(t, dsn, func(dbt *DBTest, _ string) {
dbt.mustExec("SET @@SESSION.wait_timeout = 2")

if err := dbt.db.Ping(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion connection.go
Expand Up @@ -251,7 +251,7 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
buf = append(buf, "'0000-00-00'"...)
} else {
buf = append(buf, '\'')
buf, err = appendDateTime(buf, v.In(mc.cfg.Loc))
buf, err = appendDateTime(buf, v.In(mc.cfg.Loc), mc.cfg.TimeTruncate)
if err != nil {
return "", err
}
Expand Down

0 comments on commit f07a0be

Please sign in to comment.