Explorar o código

Merge pull request #246 from go-sql-driver/buffer

remove buffer and driver indirections
Julien Schmidt %!s(int64=11) %!d(string=hai) anos
pai
achega
a26ecc1c0f
Modificáronse 3 ficheiros con 5 adicións e 5 borrados
  1. 2 2
      buffer.go
  2. 2 2
      connection.go
  3. 1 1
      driver.go

+ 2 - 2
buffer.go

@@ -24,9 +24,9 @@ type buffer struct {
 	length int
 }
 
-func newBuffer(rd io.Reader) *buffer {
+func newBuffer(rd io.Reader) buffer {
 	var b [defaultBufSize]byte
-	return &buffer{
+	return buffer{
 		buf: b[:],
 		rd:  rd,
 	}

+ 2 - 2
connection.go

@@ -18,7 +18,7 @@ import (
 )
 
 type mysqlConn struct {
-	buf              *buffer
+	buf              buffer
 	netConn          net.Conn
 	affectedRows     uint64
 	insertId         uint64
@@ -124,7 +124,7 @@ func (mc *mysqlConn) Close() (err error) {
 	}
 
 	mc.cfg = nil
-	mc.buf = nil
+	mc.buf.rd = nil
 
 	return
 }

+ 1 - 1
driver.go

@@ -45,7 +45,7 @@ func RegisterDial(net string, dial DialFunc) {
 // 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