2022-04-28 16:35:02 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
var scheme2ServerType = map[string]ServerType{
|
2022-06-18 09:45:45 +00:00
|
|
|
"redis": ServerTypeRedis,
|
|
|
|
"psql": ServerTypePostgres,
|
|
|
|
"pgsql": ServerTypePostgres,
|
|
|
|
"postgres": ServerTypePostgres,
|
|
|
|
"pgx": ServerTypePostgres,
|
|
|
|
"mysql": ServerTypeMysql,
|
|
|
|
"mariadb": ServerTypeMysql,
|
2022-04-28 16:35:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func SchemeToServerType(scheme string) ServerType {
|
|
|
|
if match, ok := scheme2ServerType[strings.ToLower(scheme)]; ok {
|
|
|
|
return match
|
|
|
|
}
|
|
|
|
return ServerTypeUnspecified
|
|
|
|
}
|