diff --git a/plugin/api/alerting/channel.go b/plugin/api/alerting/channel.go index f38a5fa0..e9135c91 100644 --- a/plugin/api/alerting/channel.go +++ b/plugin/api/alerting/channel.go @@ -25,7 +25,7 @@ func (h *AlertAPI) createChannel(w http.ResponseWriter, req *http.Request, ps ht return } - err = orm.Create(obj) + err = orm.Create(nil, obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) @@ -93,7 +93,7 @@ func (h *AlertAPI) updateChannel(w http.ResponseWriter, req *http.Request, ps ht //protect obj.ID = id obj.Created = create - err = orm.Update(&obj) + err = orm.Update(nil, &obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) diff --git a/plugin/api/alerting/rule.go b/plugin/api/alerting/rule.go index e28b07e4..2307743a 100644 --- a/plugin/api/alerting/rule.go +++ b/plugin/api/alerting/rule.go @@ -63,7 +63,7 @@ func (alertAPI *AlertAPI) createRule(w http.ResponseWriter, req *http.Request, p rule.Schedule.Interval = "1m" } - err = orm.Save(rule) + err = orm.Save(nil, rule) if err != nil { log.Error(err) alertAPI.WriteJSON(w, util.MapStr{ @@ -282,7 +282,7 @@ func (alertAPI *AlertAPI) updateRule(w http.ResponseWriter, req *http.Request, p rule.Created = create rule.Updated = time.Now() - err = orm.Update(rule) + err = orm.Update(nil, rule) if err != nil { alertAPI.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) @@ -598,7 +598,7 @@ func (alertAPI *AlertAPI) enableRule(w http.ResponseWriter, req *http.Request, p clearKV(id) } obj.Enabled = reqObj.Enabled - err = orm.Save(obj) + err = orm.Save(nil, obj) if err != nil { log.Error(err) alertAPI.WriteError(w, fmt.Sprintf("save rule error:%v", err), http.StatusInternalServerError) diff --git a/plugin/api/gateway/instance.go b/plugin/api/gateway/instance.go index b6a828b5..c993f5b4 100644 --- a/plugin/api/gateway/instance.go +++ b/plugin/api/gateway/instance.go @@ -51,7 +51,7 @@ func (h *GatewayAPI) createInstance(w http.ResponseWriter, req *http.Request, ps h.WriteError(w, "gateway instance already registered", http.StatusInternalServerError) return } - err = orm.Create(obj) + err = orm.Create(nil, obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) @@ -119,7 +119,7 @@ func (h *GatewayAPI) updateInstance(w http.ResponseWriter, req *http.Request, ps //protect obj.ID = id obj.Created = create - err = orm.Update(&obj) + err = orm.Update(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 9f6d637c..6c82875e 100644 --- a/plugin/api/index_management/index.go +++ b/plugin/api/index_management/index.go @@ -67,7 +67,7 @@ func (handler APIHandler) CreateDictItemAction(w http.ResponseWriter, req *http. return } - err = orm.Create(&dict) + err = orm.Create(nil, &dict) if err != nil { resp["status"] = false resp["error"] = err @@ -107,7 +107,7 @@ func (handler APIHandler) UpdateDictItemAction(w http.ResponseWriter, req *http. } dict.UpdatedAt = time.Now() - err = orm.Update(dict) + err = orm.Update(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 b57f1e67..8dbde3a8 100644 --- a/plugin/api/insight/dashboard.go +++ b/plugin/api/insight/dashboard.go @@ -22,7 +22,7 @@ func (h *InsightAPI) createDashboard(w http.ResponseWriter, req *http.Request, p log.Error(err) return } - err = orm.Create(obj) + err = orm.Create(nil, obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) @@ -102,7 +102,7 @@ func (h *InsightAPI) updateDashboard(w http.ResponseWriter, req *http.Request, p //protect obj.ID = id obj.Created = create - err = orm.Update(&obj) + err = orm.Update(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 a1defd49..13768e57 100644 --- a/plugin/api/insight/visualization.go +++ b/plugin/api/insight/visualization.go @@ -6,8 +6,8 @@ package insight import ( "fmt" - "infini.sh/framework/core/insight" httprouter "infini.sh/framework/core/api/router" + "infini.sh/framework/core/insight" "infini.sh/framework/core/orm" "infini.sh/framework/core/util" "net/http" @@ -24,7 +24,7 @@ func (h *InsightAPI) createVisualization(w http.ResponseWriter, req *http.Reques log.Error(err) return } - err = orm.Create(obj) + err = orm.Create(nil, obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) @@ -87,7 +87,7 @@ func (h *InsightAPI) updateVisualization(w http.ResponseWriter, req *http.Reques //protect obj.ID = id obj.Created = create - err = orm.Update(&obj) + err = orm.Update(nil, &obj) if err != nil { h.WriteError(w, err.Error(), http.StatusInternalServerError) log.Error(err) diff --git a/plugin/setup/setup.go b/plugin/setup/setup.go index a06fd50a..5efcb58f 100644 --- a/plugin/setup/setup.go +++ b/plugin/setup/setup.go @@ -411,7 +411,7 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http security.InitSecurity() //保存默认集群 - err=orm.Save(&cfg) + err=orm.Save(nil, &cfg) if err!=nil{ panic(err) } @@ -435,7 +435,7 @@ func (module *Module) initialize(w http.ResponseWriter, r *http.Request, ps http Name: rbac.RoleAdminName, }) user.Roles=role - err=orm.Save(&user) + err=orm.Save(nil, &user) if err!=nil{ panic(err) } diff --git a/service/alerting/elasticsearch/engine.go b/service/alerting/elasticsearch/engine.go index 81dfd1cf..6aa04170 100644 --- a/service/alerting/elasticsearch/engine.go +++ b/service/alerting/elasticsearch/engine.go @@ -626,7 +626,7 @@ func (engine *Engine) Do(rule *alerting.Rule) error { } } - err = orm.Save(alertItem) + err = orm.Save(nil, alertItem) if err != nil { log.Error(err) } @@ -1131,7 +1131,7 @@ func getLastAlertMessage(ruleID string, duration time.Duration) (*alerting.Alert func saveAlertMessageToES(message *alerting.AlertMessage) error { message.Updated = time.Now() - return orm.Save(message) + return orm.Save(nil, message) } func saveAlertMessage(message *alerting.AlertMessage) error {