Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1092)

Unified Diff: src/pkg/database/sql/driver/driver.go

Issue 43510044: code review 43510044: database/sql: let drivers access their own driver.Rows.
Patch Set: diff -r 7e1a4e190b02 https://code.google.com/p/go Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/pkg/database/sql/fakedb_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | src/pkg/database/sql/fakedb_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b