aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/sql.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/sql/sql.go')
-rw-r--r--src/database/sql/sql.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index 731b7a7f79..ad9179cf7d 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -18,6 +18,7 @@ import (
"fmt"
"io"
"runtime"
+ "sort"
"sync"
)
@@ -36,6 +37,16 @@ func Register(name string, driver driver.Driver) {
drivers[name] = driver
}
+// Drivers returns a sorted list of the names of the registered drivers.
+func Drivers() []string {
+ var list []string
+ for name := range drivers {
+ list = append(list, name)
+ }
+ sort.Strings(list)
+ return list
+}
+
// RawBytes is a byte slice that holds a reference to memory owned by
// the database itself. After a Scan into a RawBytes, the slice is only
// valid until the next call to Next, Scan, or Close.