refactor: 按go modules规范重构

This commit is contained in:
2026-04-15 15:19:39 +08:00
parent 8c5cd3705a
commit 5d4bf761b8
21 changed files with 524 additions and 679 deletions
@@ -0,0 +1,26 @@
package neo4j
import (
"context"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"knowledge-graph-backend/internal/config"
)
func NewDriver(cfg config.Neo4jConfig) neo4j.DriverWithContext {
ctx := context.Background()
driver, err := neo4j.NewDriverWithContext(
cfg.URI,
neo4j.BasicAuth(cfg.Username, cfg.Password, ""))
if err != nil {
panic(err)
}
err = driver.VerifyConnectivity(ctx)
if err != nil {
panic(err)
}
return driver
}