Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSo
import "database/sql"
import _ "github.com/go-sql-driver/mysql"

db, e := sql.Open("mysql", "user:password@/dbname?charset=utf8")
db, err := sql.Open("mysql", "user:password@/dbname")
```

[Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples").
Expand Down
17 changes: 14 additions & 3 deletions driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
// You can obtain one at http://mozilla.org/MPL/2.0/.

// Go MySQL Driver - A MySQL-Driver for Go's database/sql package
//
// The driver should be used via the database/sql package:
//
// import "database/sql"
// import _ "github.com/go-sql-driver/mysql"
//
// db, err := sql.Open("mysql", "user:password@/dbname")
//
// See https://github.com/go-sql-driver/mysql#usage for details
package mysql

import (
Expand All @@ -14,12 +23,14 @@ import (
"net"
)

type mysqlDriver struct{}
// This struct is exported to make the driver directly accessible.
// In general the driver is used via the database/sql package.
type MySQLDriver struct{}

// Open new Connection.
// See https://github.com/go-sql-driver/mysql#dsn-data-source-name for how
// the DSN string is formated
func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
func (d *MySQLDriver) Open(dsn string) (driver.Conn, error) {
var err error

// New mysqlConn
Expand Down Expand Up @@ -78,5 +89,5 @@ func (d *mysqlDriver) Open(dsn string) (driver.Conn, error) {
}

func init() {
sql.Register("mysql", &mysqlDriver{})
sql.Register("mysql", &MySQLDriver{})
}