From b93fb2f3c2504889ae24dbbbeddd98e60d21437c Mon Sep 17 00:00:00 2001 From: liugq Date: Tue, 13 Dec 2022 14:26:40 +0800 Subject: [PATCH] refactoring orm.Delete --- plugin/api/alerting/rule.go | 2 +- plugin/api/gateway/instance.go | 2 +- plugin/api/index_management/index.go | 2 +- plugin/api/insight/dashboard.go | 2 +- plugin/api/insight/visualization.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/api/alerting/rule.go b/plugin/api/alerting/rule.go index 2307743a..ae382d77 100644 --- a/plugin/api/alerting/rule.go +++ b/plugin/api/alerting/rule.go @@ -347,7 +347,7 @@ func (alertAPI *AlertAPI) deleteRule(w http.ResponseWriter, req *http.Request, p return } - err = orm.Delete(&obj) + err = orm.Delete(nil, &obj) if err != nil { alertAPI.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) diff --git a/plugin/api/gateway/instance.go b/plugin/api/gateway/instance.go index c993f5b4..3e0791f6 100644 --- a/plugin/api/gateway/instance.go +++ b/plugin/api/gateway/instance.go @@ -147,7 +147,7 @@ func (h *GatewayAPI) deleteInstance(w http.ResponseWriter, req *http.Request, ps return } - err = orm.Delete(&obj) + err = orm.Delete(nil, &obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) diff --git a/plugin/api/index_management/index.go b/plugin/api/index_management/index.go index 6c82875e..6536db42 100644 --- a/plugin/api/index_management/index.go +++ b/plugin/api/index_management/index.go @@ -84,7 +84,7 @@ func (handler APIHandler) DeleteDictItemAction(w http.ResponseWriter, req *http. dict.ID = id resp := newResponseBody() - err := orm.Delete(dict) + err := orm.Delete(nil, dict) if err != nil { resp["status"] = false resp["error"] = err diff --git a/plugin/api/insight/dashboard.go b/plugin/api/insight/dashboard.go index 8dbde3a8..0ec9b26e 100644 --- a/plugin/api/insight/dashboard.go +++ b/plugin/api/insight/dashboard.go @@ -130,7 +130,7 @@ func (h *InsightAPI) deleteDashboard(w http.ResponseWriter, req *http.Request, p return } - err = orm.Delete(&obj) + err = orm.Delete(nil, &obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) diff --git a/plugin/api/insight/visualization.go b/plugin/api/insight/visualization.go index 13768e57..576aaa19 100644 --- a/plugin/api/insight/visualization.go +++ b/plugin/api/insight/visualization.go @@ -115,7 +115,7 @@ func (h *InsightAPI) deleteVisualization(w http.ResponseWriter, req *http.Reques return } - err = orm.Delete(&obj) + err = orm.Delete(nil, &obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err)