Skip to content

Commit

Permalink
Merge fix drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagozs committed Nov 25, 2021
2 parents ffb0c21 + d7b1e38 commit 0fec0b1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions v1/cache/drivers/drivers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@ type DriverPort interface {
}

func NewDriver(driver Driver, opts ...Options) (DriverPort, error) {
var db DriverPort
var err error
switch driver {
case BUNTDB:
return buntdblayer.NewBuntDB(opts...), nil
db, err = buntdblayer.NewBuntDB(opts...)
case REDIS:
return redislayer.NewRedis(opts...), nil
db, err = redislayer.NewRedis(opts...)
}
return &Drivers{}, fmt.Errorf("unknown driver type: %s", driver.String())
if err != nil {
return nil, err
}
return &Drivers{db: db}, fmt.Errorf("unknown driver type: %s", driver.String())
}

func (d *Drivers) WriteKeyVal(key string, val string) error {
Expand Down

0 comments on commit 0fec0b1

Please sign in to comment.