Feat: 实现知识图谱数据库的检索方法,并对外提供接口
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user