Skip to content

Commit 9dee4ca

Browse files
pschultzjulienschmidt
authored andcommitted
Fix documentation for timeout parameters (#535)
* Fix documentation for timeout parameters * Add readme section about connection pool * Add myself to AUTHORS
1 parent c1601d4 commit 9dee4ca

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Michael Woolnough <michael.woolnough at gmail.com>
4242
Nicola Peduzzi <thenikso at gmail.com>
4343
Olivier Mengué <dolmen at cpan.org>
4444
Paul Bonser <misterpib at gmail.com>
45+
Peter Schultz <peter.schultz at classmarkets.com>
4546
Runrioter Wung <runrioter at gmail.com>
4647
Soroush Pour <me at soroushjp.com>
4748
Stan Putrya <root.vagner at gmail.com>

README.md

+12-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac
1515
* [Address](#address)
1616
* [Parameters](#parameters)
1717
* [Examples](#examples)
18+
* [Connection pool and timeouts](#connection-pool-and-timeouts)
1819
* [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
1920
* [time.Time support](#timetime-support)
2021
* [Unicode support](#unicode-support)
@@ -260,11 +261,11 @@ Default: false
260261
##### `readTimeout`
261262

262263
```
263-
Type: decimal number
264+
Type: duration
264265
Default: 0
265266
```
266267

267-
I/O read timeout. The value must be a decimal number with an unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
268+
I/O read timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
268269

269270
##### `strict`
270271

@@ -283,11 +284,11 @@ By default MySQL also treats notes as warnings. Use [`sql_notes=false`](http://d
283284
##### `timeout`
284285

285286
```
286-
Type: decimal number
287+
Type: duration
287288
Default: OS default
288289
```
289290

290-
*Driver* side connection timeout. The value must be a decimal number with an unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*. To set a server side timeout, use the parameter [`wait_timeout`](http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
291+
Timeout for establishing connections, aka dial timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
291292

292293
##### `tls`
293294

@@ -302,11 +303,11 @@ Default: false
302303
##### `writeTimeout`
303304

304305
```
305-
Type: decimal number
306+
Type: duration
306307
Default: 0
307308
```
308309

309-
I/O write timeout. The value must be a decimal number with an unit suffix ( *"ms"*, *"s"*, *"m"*, *"h"* ), such as *"30s"*, *"0.5m"* or *"1m30s"*.
310+
I/O write timeout. The value must be a decimal number with a unit suffix (*"ms"*, *"s"*, *"m"*, *"h"*), such as *"30s"*, *"0.5m"* or *"1m30s"*.
310311

311312

312313
##### System Variables
@@ -380,6 +381,11 @@ No Database preselected:
380381
user:password@/
381382
```
382383

384+
385+
### Connection pool and timeouts
386+
The connection pool is managed by Go's database/sql package. For details on how to configure the size of the pool and how long connections stay in the pool see `*DB.SetMaxOpenConns`, `*DB.SetMaxIdleConns`, and `*DB.SetConnMaxLifetime` in the [database/sql documentation](https://golang.org/pkg/database/sql/). The read, write, and dial timeouts for each individual connection are configured with the DSN parameters [`readTimeout`](#readtimeout), [`writeTimeout`](#writetimeout), and [`timeout`](#timeout), respectively.
387+
388+
383389
### `LOAD DATA LOCAL INFILE` support
384390
For this feature you need direct access to the package. Therefore you must change the import path (no `_`):
385391
```go

0 commit comments

Comments
 (0)