-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
47 lines (33 loc) · 911 Bytes
/
config.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 events
type Config struct {
Persistence Persistence `yaml:"persistence"`
Path string `yaml:"-"`
}
func (cfg *Config) SetPath(path string) {
cfg.Path = path
if cfg.Persistence.Driver == BadgerDB && cfg.Persistence.DSN == "" {
cfg.Persistence.DSN = path + "/data"
}
}
type Persistence struct {
Driver StorageDriver `yaml:"driver"`
DSN string `yaml:"dsn"`
}
type StorageDriver string
const (
// InMemory
InMem StorageDriver = "inmem"
// Key-value Database
BadgerDB StorageDriver = "badger"
Redis StorageDriver = "redis"
// Time Series Database
InfluxDB StorageDriver = "influxdb"
InfluxDBv2 StorageDriver = "influxdb2"
// Relational DBMS
MySQL StorageDriver = "mysql"
SQLServer StorageDriver = "sqlserver"
PostgreSQL StorageDriver = "postgres"
SQLite StorageDriver = "sqlite"
// Document Database
MongoDB StorageDriver = "mongo"
)