Feat: 实现知识图谱数据库的检索方法,并对外提供接口

This commit is contained in:
2026-04-13 15:21:54 +08:00
parent 6764095ed1
commit 258e5d21f9
8 changed files with 339 additions and 277 deletions
+5 -5
View File
@@ -8,12 +8,12 @@ import (
)
type NodeHandler struct {
dataService *services.DataService
service services.GraphService
}
func NewNodeHandler(dataService *services.DataService) *NodeHandler {
func NewNodeHandler(service services.GraphService) *NodeHandler {
return &NodeHandler{
dataService: dataService,
service: service,
}
}
@@ -27,7 +27,7 @@ func (h *NodeHandler) GetNodeByID(c *gin.Context) {
return
}
node, found := h.dataService.GetNodeByID(nodeID)
node, found := h.service.GetNodeByID(nodeID)
if !found {
c.JSON(http.StatusNotFound, gin.H{
"error": "Not Found",
@@ -49,7 +49,7 @@ func (h *NodeHandler) GetNeighbors(c *gin.Context) {
return
}
neighbors, found := h.dataService.GetNeighbors(nodeID)
neighbors, found := h.service.GetNeighbors(nodeID)
if !found {
c.JSON(http.StatusNotFound, gin.H{
"error": "Not Found",