File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-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")
16
+ //
17
+ // See https://github.com/go-sql-driver/mysql#usage for details
9
18
package mysql
10
19
11
20
import (
@@ -14,12 +23,14 @@ import (
14
23
"net"
15
24
)
16
25
17
- type mysqlDriver struct {}
26
+ // This struct is exported to make the driver directly accessible.
27
+ // In general the driver is used via the database/sql package.
28
+ type MySQLDriver struct {}
18
29
19
30
// Open new Connection.
20
31
// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
21
32
// the DSN string is formated
22
- func (d * mysqlDriver ) Open (dsn string ) (driver.Conn , error ) {
33
+ func (d * MySQLDriver ) Open (dsn string ) (driver.Conn , error ) {
23
34
var err error
24
35
25
36
// New mysqlConn
@@ -78,5 +89,5 @@ func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
78
89
}
79
90
80
91
func init () {
81
- sql .Register ("mysql" , & mysqlDriver {})
92
+ sql .Register ("mysql" , & MySQLDriver {})
82
93
}
You can’t perform that action at this time.
0 commit comments