File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSo
60
60
import " database/sql"
61
61
import _ " github.com/go-sql-driver/mysql"
62
62
63
- db , e := sql.Open (" mysql" , " user:password@/dbname?charset=utf8 " )
63
+ db , err := sql.Open (" mysql" , " user:password@/dbname" )
64
64
```
65
65
66
66
[ Examples are available in our Wiki] ( https://github.com/go-sql-driver/mysql/wiki/Examples " Go-MySQL-Driver Examples ") .
Original file line number Diff line number Diff line change 6
6
// You can obtain one at http://mozilla.org/MPL/2.0/.
7
7
8
8
// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
9
+ //
10
+ // The driver should be used via the database/sql package:
11
+ //
12
+ // import "database/sql"
13
+ // import _ "github.com/go-sql-driver/mysql"
14
+ //
15
+ // db, err := sql.Open("mysql", "user:password@/dbname")
9
16
package mysql
10
17
11
18
import (
@@ -14,12 +21,14 @@ import (
14
21
"net"
15
22
)
16
23
17
- type mysqlDriver struct {}
24
+ // This struct is exported to make the driver directly accessible.
25
+ // In general the driver is used via the database/sql package.
26
+ type MySQLDriver struct {}
18
27
19
28
// Open new Connection.
20
29
// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
21
30
// the DSN string is formated
22
- func (d * mysqlDriver ) Open (dsn string ) (driver.Conn , error ) {
31
+ func (d * MySQLDriver ) Open (dsn string ) (driver.Conn , error ) {
23
32
var err error
24
33
25
34
// New mysqlConn
@@ -78,5 +87,5 @@ func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
78
87
}
79
88
80
89
func init () {
81
- sql .Register ("mysql" , & mysqlDriver {})
90
+ sql .Register ("mysql" , & MySQLDriver {})
82
91
}
You can’t perform that action at this time.
0 commit comments