Index: src/pkg/database/sql/driver/driver.go |
=================================================================== |
--- a/src/pkg/database/sql/driver/driver.go |
+++ b/src/pkg/database/sql/driver/driver.go |
@@ -54,6 +54,26 @@ |
// you shouldn't return ErrBadConn. |
var ErrBadConn = errors.New("driver: bad connection") |
+// SqlRowType is *Row or *Rows from database/sql. |
+type SqlRowType interface{} |
+ |
+// Inspector is an optional interface that may be implemented by a Driver. |
+// |
+// If a driver implements Inspector, the sql package will pass it a function on |
+// Register. That function can be stored and used to access the drivers native |
+// implementation of driver.Rows. |
+type Inspector interface { |
+ |
+ // SetInspect is called by the sql package and provides the Driver with |
+ // a function to extract driver.Rows from *sql.Rows or *sql.Row. |
+ // |
+ // With it, a driver can provide additional functions to access database |
+ // specific metadata known to the driver but not available in database/sql, |
+ // e.g. the expected number of rows, column types, the column charset or |
+ // the name of a column in its originating table. |
+ SetInspect(inspect func(SqlRowType) (Rows, error)) |
+} |
+ |
// Execer is an optional interface that may be implemented by a Conn. |
// |
// If a Conn does not implement Execer, the sql package's DB.Exec will |