forked from gobuffalo/pop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pop.go
35 lines (27 loc) · 842 Bytes
/
pop.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package pop
import "strings"
// AvailableDialects lists the available database dialects
var AvailableDialects []string
var dialectSynonyms = make(map[string]string)
// map of dialect specific url parsers
var urlParser = make(map[string]func(*ConnectionDetails) error)
// map of dialect specific connection details finalizers
var finalizer = make(map[string]func(*ConnectionDetails))
// map of connection creators
var newConnection = make(map[string]func(*ConnectionDetails) (dialect, error))
// DialectSupported checks support for the given database dialect
func DialectSupported(d string) bool {
for _, ad := range AvailableDialects {
if ad == d {
return true
}
}
return false
}
func normalizeSynonyms(dialect string) string {
d := strings.ToLower(dialect)
if syn, ok := dialectSynonyms[d]; ok {
d = syn
}
return d
}