forked from mrz1836/go-datastore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
engine.go
47 lines (40 loc) · 922 Bytes
/
engine.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
36
37
38
39
40
41
42
43
44
45
46
47
package datastore
// Engine is the different engines that are supported (database)
type Engine string
// Supported engines (databases)
const (
Empty Engine = "empty"
MongoDB Engine = "mongodb"
MySQL Engine = "mysql"
PostgreSQL Engine = "postgresql"
SQLite Engine = "sqlite"
)
// index creation constants
const (
Postgres = "postgres"
JSON = "JSON"
JSONB = "JSONB"
)
// SQLDatabases is the list of supported SQL databases (via GORM)
var SQLDatabases = []Engine{
MySQL,
PostgreSQL,
SQLite,
}
// String is the string version of engine
func (e Engine) String() string {
return string(e)
}
// IsEmpty will return true if the datastore is not set
func (e Engine) IsEmpty() bool {
return e == Empty
}
// IsSQLEngine check whether the string already is in the slice
func IsSQLEngine(e Engine) bool {
for _, b := range SQLDatabases {
if b == e {
return true
}
}
return false
}