Add a new function named SupportedDBs.

This function allows the callers to programatically ascertain which
database backend drivers are registered and therefore supported.
This commit is contained in:
Dave Collins 2013-09-15 15:18:46 -05:00
parent a2946ea14b
commit 62e38e29e5

10
db.go
View file

@ -206,3 +206,13 @@ func OpenDB(dbtype string, argstr string) (pbdb Db, err error) {
}
return nil, DbUnknownType
}
// SupportedDBs returns a slice of strings that represent the database drivers
// that have been registered and are therefore supported.
func SupportedDBs() []string {
var supportedDBs []string
for _, drv := range driverList {
supportedDBs = append(supportedDBs, drv.DbType)
}
return supportedDBs
}