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:
parent
a2946ea14b
commit
62e38e29e5
1 changed files with 10 additions and 0 deletions
10
db.go
10
db.go
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue