cleaner tests i thought

This commit is contained in:
breel
2020-08-01 01:09:35 -06:00
parent baf0aaa287
commit 71b1de33ec
7 changed files with 141 additions and 141 deletions

View File

@@ -15,12 +15,15 @@ type Driver interface {
Delete(context.Context, string, interface{}) error
}
func New() Driver {
func New(path ...string) Driver {
if len(path) == 0 {
path = []string{config.New().DBURI}
}
switch strings.ToLower(config.New().DriverType) {
case "mongo":
return NewMongo()
return NewMongo(path[0])
case "boltdb":
return NewBoltDB()
return NewBoltDB(path[0])
}
panic("unknown driver type " + strings.ToLower(config.New().DriverType))
}