Compatible with both bolt and mongo, wewt
This commit is contained in:
@@ -3,9 +3,11 @@ package storage
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"local/dndex/config"
|
||||
"local/dndex/storage/driver"
|
||||
"local/dndex/storage/entity"
|
||||
"local/dndex/storage/operator"
|
||||
"strings"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
@@ -15,9 +17,15 @@ type Graph struct {
|
||||
}
|
||||
|
||||
func NewGraph() Graph {
|
||||
mongo := driver.NewMongo()
|
||||
var d driver.Driver
|
||||
switch strings.ToLower(config.New().DriverType) {
|
||||
case "mongo":
|
||||
d = driver.NewMongo()
|
||||
case "boltdb":
|
||||
d = driver.NewBoltDB()
|
||||
}
|
||||
return Graph{
|
||||
driver: mongo,
|
||||
driver: d,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user