Feat: 实现知识图谱数据库的检索方法,并对外提供接口
This commit is contained in:
@@ -8,22 +8,22 @@ import (
|
||||
)
|
||||
|
||||
type GraphHandler struct {
|
||||
dataService *services.DataService
|
||||
service services.GraphService
|
||||
}
|
||||
|
||||
func NewGraphHandler(dataService *services.DataService) *GraphHandler {
|
||||
func NewGraphHandler(service services.GraphService) *GraphHandler {
|
||||
return &GraphHandler{
|
||||
dataService: dataService,
|
||||
service: service,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *GraphHandler) GetGraphData(c *gin.Context) {
|
||||
data := h.dataService.GetGraphData()
|
||||
data := h.service.GetGraphData()
|
||||
c.JSON(http.StatusOK, data)
|
||||
}
|
||||
|
||||
func (h *GraphHandler) GetStats(c *gin.Context) {
|
||||
stats := h.dataService.GetStats()
|
||||
stats := h.service.GetStats()
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"stats": stats,
|
||||
"timestamp": gin.H{
|
||||
|
||||
Reference in New Issue
Block a user