Refactor: 封装获取neo4j的连接函数
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
package neo4j
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"knowledge-graph-backend/config"
|
||||
)
|
||||
|
||||
func TestDoConnect(t *testing.T) {
|
||||
func TestNewDriver(t *testing.T) {
|
||||
cnf, err := config.Load()
|
||||
if err != nil {
|
||||
t.Errorf("[cnf]: %v", err)
|
||||
@@ -16,5 +17,6 @@ func TestDoConnect(t *testing.T) {
|
||||
Username: cnf.Neo4j.Username,
|
||||
Password: cnf.Neo4j.Password,
|
||||
}
|
||||
DoConnect(cfg)
|
||||
driver := NewDriver(cfg)
|
||||
defer driver.Close(context.Background())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user