github.com/royge/pop@v4.13.1+incompatible/pop.go (about)

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