Impl delete find filters for boltdb
This commit is contained in:
26
storage/driver/driver.go
Normal file
26
storage/driver/driver.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package driver
|
||||
|
||||
import (
|
||||
"context"
|
||||
"local/dndex/config"
|
||||
"strings"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
type Driver interface {
|
||||
Find(context.Context, string, interface{}) (chan bson.Raw, error)
|
||||
Update(context.Context, string, interface{}, interface{}) error
|
||||
Insert(context.Context, string, interface{}) error
|
||||
Delete(context.Context, string, interface{}) error
|
||||
}
|
||||
|
||||
func New() Driver {
|
||||
switch strings.ToLower(config.New().DriverType) {
|
||||
case "mongo":
|
||||
return NewMongo()
|
||||
case "boltdb":
|
||||
return NewBoltDB()
|
||||
}
|
||||
panic("unknown driver type " + strings.ToLower(config.New().DriverType))
|
||||
}
|
||||
Reference in New Issue
Block a user