Skip to content

Dsb add parameters#627

Merged
LordofAvernus merged 2 commits into
mainfrom
dsb_add_parameters
May 21, 2026
Merged

Dsb add parameters#627
LordofAvernus merged 2 commits into
mainfrom
dsb_add_parameters

Conversation

@iwanghc
Copy link
Copy Markdown
Collaborator

@iwanghc iwanghc commented May 21, 2026

User description

关联的 issue

https://github.com/actiontech/sqle-ee/issues/2884

描述你的变更

全局dashboard新增查询参数和展示列

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc

link actiontech/sqle#3309


Description

  • 添加创建时间、更新时间过滤参数至查询接口

  • 新增更新时间字段到工单响应结构体

  • 更新 SQL 查询及 swagger 文档支持新字段


Diagram Walkthrough

flowchart LR
  A["\"请求传参(filter_create_time, filter_update_time)\""] --> B["\"API服务层设置参数并响应更新时间\""]
  B --> C["\"业务逻辑层传递更新时间至存储层\""]
  C --> D["\"数据库查询与 SQL 条件更新\""]
  B --> E["\"swagger文档更新\""]
Loading

File Walkthrough

Relevant files
Enhancement
6 files
data_export_workflow.go
添加查询时间过滤参数与更新时间响应                                                                               
+13/-0   
data_export_workflow.go
更新WorkflowRecord新增更新时间字段                                                                 
+1/-0     
data_export_workflow.go
设置响应中更新时间字段                                                                                           
+1/-0     
workflow.go
增加更新时间查询条件及字段映射                                                                                   
+18/-1   
workflow.go
添加过滤参数与更新时间字段至响应                                                                                 
+5/-0     
data_export_workflow.go
更新查询 URL参数,传递更新时间过滤条件                                                                       
+16/-0   
Documentation
2 files
swagger.json
更新swagger.json,添加更新时间字段描述                                                               
+5/-0     
swagger.yaml
更新swagger.yaml,配置更新时间字段格式                                                               
+4/-0     

@actiontech-bot actiontech-bot requested review from LordofAvernus and removed request for LordofAvernus May 21, 2026 06:44
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
添加 nil 检查

建议在使用 w.WorkflowRecord.UpdateTime 前先检查 w.WorkflowRecord 是否为 nil,以避免可能的 nil 指针引用引发
panic。可以通过内联函数或提前判断来添加 nil 检查,并在为 nil 时提供合理的默认值。

internal/dms/service/data_export_workflow.go [183]

-UpdatedAt:      w.WorkflowRecord.UpdateTime,
+UpdatedAt: func() time.Time {
+    if w.WorkflowRecord != nil {
+        return w.WorkflowRecord.UpdateTime
+    }
+    return time.Time{}
+}(),
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly adds a nil check for w.WorkflowRecord before using its UpdateTime, which prevents a potential panic. The improvement is valid and enhances error handling, though it's a moderate change.

Medium
验证时间字符串格式

建议在传递时间过滤参数前对时间字符串格式进行验证,确保符合预期格式,防止因为无效的时间格式在后续解析时导致异常。同样对其他新增的时间过滤参数也建议做类似验证。

pkg/dms-common/dmsobject/data_export_workflow.go [81-83]

 if req.FilterCreateTimeFrom != "" {
-		query.Set("filter_create_time_from", req.FilterCreateTimeFrom)
+    if _, err := time.Parse(time.RFC3339, req.FilterCreateTimeFrom); err == nil {
+        query.Set("filter_create_time_from", req.FilterCreateTimeFrom)
+    }
 }
Suggestion importance[1-10]: 6

__

Why: The suggestion adds validation for the time string format using time.Parse, which improves data integrity when setting query parameters. It is a minor yet useful improvement, hence a slightly lower score.

Low

@LordofAvernus LordofAvernus merged commit f138989 into main May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants