From 29acc13058a836bdc64e33bda873431f91254997 Mon Sep 17 00:00:00 2001 From: taolx0 Date: Tue, 12 Nov 2024 16:45:40 +0800 Subject: [PATCH] chore:Add an IsDefaultRuleTemplate field to distinguish whether a rule template is a default rule template. --- sqle/api/controller/v1/rule.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sqle/api/controller/v1/rule.go b/sqle/api/controller/v1/rule.go index 848343c44..f3581877c 100644 --- a/sqle/api/controller/v1/rule.go +++ b/sqle/api/controller/v1/rule.go @@ -643,10 +643,12 @@ func getRuleTemplateTips(c echo.Context, projectId string, filterDBType string) ruleTemplateTipsRes := make([]RuleTemplateTipResV1, 0, len(ruleTemplates)) for _, roleTemplate := range ruleTemplates { + isDefaultRuleTemplate := roleTemplate.Name == fmt.Sprintf("default_%s", roleTemplate.DBType) ruleTemplateTipRes := RuleTemplateTipResV1{ - ID: roleTemplate.GetIDStr(), - Name: roleTemplate.Name, - DBType: roleTemplate.DBType, + ID: roleTemplate.GetIDStr(), + Name: roleTemplate.Name, + DBType: roleTemplate.DBType, + IsDefaultRuleTemplate: isDefaultRuleTemplate, } ruleTemplateTipsRes = append(ruleTemplateTipsRes, ruleTemplateTipRes) }