Skip to content

Dsb add parameters#3309

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

Dsb add parameters#3309
LordofAvernus merged 8 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

描述你的变更

  1. 更新dms依赖,升级go版本,golang:1.19.6 -> golang:1.24.0-bullseye
  2. 升级 golint版本,并修复golint检查报错, golangci-lint:v1.45.2 -> golangci-lint:v1.64.8-alpine
  3. 新增全局dashboard工单查询接口定义参数

确认项(pr提交后操作)

Tip

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


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


Description

  • 新增全局工单查询过滤参数(创建人、时间区间)

  • 统一错误返回格式,使用 fmt.Errorf("%s", ...)

  • 升级 Go 版本及相关依赖包

  • 更新 CI 和 lint 配置,完善 Swagger 文档


Diagram Walkthrough

flowchart LR
  A["新增过滤参数及文档更新"] --> B["错误格式统一改进"]
  B --> C["升级 Go 版本和依赖"]
  C --> D["更新 CI/CD 配置"]
Loading

File Walkthrough

Relevant files
Enhancement
5 files
workflow_manage.go
新增创建人及时间过滤参数                                                                                         
+14/-3   
logger.go
调整日志 Debug 调用方式                                                                                   
+1/-1     
types.go
增加 updated_at 与创建者字段                                                                         
+14/-12 
Makefile
更新编译器和 Lint 镜像版本                                                                                 
+2/-2     
go.mod
升级 Go 模块版本及依赖包                                                                                     
+17/-16 
Bug fix
8 files
workflow.go
修正错误格式化调用                                                                                               
+3/-3     
validator.go
统一错误消息格式化逻辑                                                                                           
+1/-1     
context.go
返回错误信息时传递实际错误                                                                                       
+1/-1     
plugin_adapter_v2.go
优化错误信息格式化处理                                                                                           
+2/-2     
driver_audit.go
修正审计模块错误返回格式                                                                                         
+2/-2     
configuration.go
修复通知记录错误处理逻辑                                                                                         
+2/-2     
role_list.go
增加预处理资源释放(defer close)                                                                     
+2/-0     
sqled.go
错误处理调用格式调整                                                                                             
+1/-1     
Documentation
3 files
docs.go
扩展 Swagger 文档,新增过滤项                                                                           
+54/-0   
swagger.json
调整 Swagger JSON 新增过滤参数                                                                     
+54/-0   
swagger.yaml
更新 Swagger YAML,增加过滤项描述                                                                   
+40/-0   
Tests
1 files
splitter_test.go
测试中错误处理函数更新                                                                                           
+3/-3     
Configuration changes
2 files
ci.yml
更新 Go 版本及 Lint 配置                                                                               
+3/-3     
.golangci.yml
升级 golangci-lint 版本并添加豁免规则                                                             
+17/-2   
Additional files
1 files
workflow.go +1/-1     

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Reviewer Guide 🔍

(Review updated until commit a513907)

🎫 Ticket compliance analysis 🔶

2884 - Partially compliant

Compliant requirements:

  • 规则执行报错时返回错误值已补充

Non-compliant requirements:

Requires further human verification:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

错误处理

在保存通知记录时由原先忽略错误改为直接返回错误,这可能会影响上层调用逻辑,请确认调用方已做好相应的错误处理和兼容性调整。

	TaskId: curTaskRecord.TaskId,
}
if err := s.Save(&record); err != nil {
	return err
}

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
返回保存错误

在通知记录保存时返回错误而不是nil,确保调用方能够正确捕获和处理保存失败的情况,避免错误被静默忽略带来潜在问题。

sqle/model/configuration.go [371-373]

     if err := s.Save(&record); err != nil {
--			return nil
-+			return err
+    		return err
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly returns the error from s.Save(&record) instead of silently returning nil, ensuring that error conditions are properly propagated.

Medium
确保释放数据库资源

新增了defer关闭prepared
statement的代码,这对防止数据库连接资源泄露非常重要。请检查所有类似数据库操作,确保每个使用PrepareNamed后都调用Close。

sqle/model/role_list.go [117-122]

     nameStmtTasksQuery, err := sqlxDb.PrepareNamed(selectQuery)
     if err != nil {
     	return err
     }
-+	defer nameStmtTasksQuery.Close()
+    defer nameStmtTasksQuery.Close()
     err = nameStmtTasksQuery.Select(result, data)
Suggestion importance[1-10]: 8

__

Why: The addition of defer nameStmtTasksQuery.Close() prevents potential resource leaks after preparing a statement, which is crucial for robust database handling.

Medium
保证错误传播

在数据库查询返回错误时,直接返回该错误以确保错误信息能够正确传递给上层调用,防止部分错误被忽略导致错误的数据处理。

sqle/driver/mysql/session/context.go [1428-1431]

     timeoutResults, err := c.e.Db.Query(timeoutQuery)
     if err != nil {
--		return count, 0, nil
-+		return count, 0, err
+    		return count, 0, err
     }
Suggestion importance[1-10]: 8

__

Why: By returning the error from c.e.Db.Query(timeoutQuery) instead of suppressing it, this suggestion ensures that errors are correctly bubbled up, aiding in proper error handling.

Medium

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 3e4152a

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
返回保存错误

在通知记录保存时返回错误而不是nil,确保调用方能够正确捕获和处理保存失败的情况,避免错误被静默忽略带来潜在问题。

sqle/model/configuration.go [371-373]

     if err := s.Save(&record); err != nil {
--			return nil
-+			return err
+    		return err
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly returns the error from s.Save(&record) instead of silently returning nil, ensuring that error conditions are properly propagated.

Medium
确保释放数据库资源

新增了defer关闭prepared
statement的代码,这对防止数据库连接资源泄露非常重要。请检查所有类似数据库操作,确保每个使用PrepareNamed后都调用Close。

sqle/model/role_list.go [117-122]

     nameStmtTasksQuery, err := sqlxDb.PrepareNamed(selectQuery)
     if err != nil {
     	return err
     }
-+	defer nameStmtTasksQuery.Close()
+    defer nameStmtTasksQuery.Close()
     err = nameStmtTasksQuery.Select(result, data)
Suggestion importance[1-10]: 8

__

Why: The addition of defer nameStmtTasksQuery.Close() prevents potential resource leaks after preparing a statement, which is crucial for robust database handling.

Medium
保证错误传播

在数据库查询返回错误时,直接返回该错误以确保错误信息能够正确传递给上层调用,防止部分错误被忽略导致错误的数据处理。

sqle/driver/mysql/session/context.go [1428-1431]

     timeoutResults, err := c.e.Db.Query(timeoutQuery)
     if err != nil {
--		return count, 0, nil
-+		return count, 0, err
+    		return count, 0, err
     }
Suggestion importance[1-10]: 8

__

Why: By returning the error from c.e.Db.Query(timeoutQuery) instead of suppressing it, this suggestion ensures that errors are correctly bubbled up, aiding in proper error handling.

Medium

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 4bedd97

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
返回保存错误

在通知记录保存时返回错误而不是nil,确保调用方能够正确捕获和处理保存失败的情况,避免错误被静默忽略带来潜在问题。

sqle/model/configuration.go [371-373]

     if err := s.Save(&record); err != nil {
--			return nil
-+			return err
+    		return err
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly returns the error from s.Save(&record) instead of silently returning nil, ensuring that error conditions are properly propagated.

Medium
确保释放数据库资源

新增了defer关闭prepared
statement的代码,这对防止数据库连接资源泄露非常重要。请检查所有类似数据库操作,确保每个使用PrepareNamed后都调用Close。

sqle/model/role_list.go [117-122]

     nameStmtTasksQuery, err := sqlxDb.PrepareNamed(selectQuery)
     if err != nil {
     	return err
     }
-+	defer nameStmtTasksQuery.Close()
+    defer nameStmtTasksQuery.Close()
     err = nameStmtTasksQuery.Select(result, data)
Suggestion importance[1-10]: 8

__

Why: The addition of defer nameStmtTasksQuery.Close() prevents potential resource leaks after preparing a statement, which is crucial for robust database handling.

Medium
保证错误传播

在数据库查询返回错误时,直接返回该错误以确保错误信息能够正确传递给上层调用,防止部分错误被忽略导致错误的数据处理。

sqle/driver/mysql/session/context.go [1428-1431]

     timeoutResults, err := c.e.Db.Query(timeoutQuery)
     if err != nil {
--		return count, 0, nil
-+		return count, 0, err
+    		return count, 0, err
     }
Suggestion importance[1-10]: 8

__

Why: By returning the error from c.e.Db.Query(timeoutQuery) instead of suppressing it, this suggestion ensures that errors are correctly bubbled up, aiding in proper error handling.

Medium

@iwanghc iwanghc force-pushed the dsb_add_parameters branch from 4bedd97 to 6167d9c Compare May 21, 2026 06:35
@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit 6167d9c

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 21, 2026

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
返回保存错误

在通知记录保存时返回错误而不是nil,确保调用方能够正确捕获和处理保存失败的情况,避免错误被静默忽略带来潜在问题。

sqle/model/configuration.go [371-373]

     if err := s.Save(&record); err != nil {
--			return nil
-+			return err
+    		return err
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly returns the error from s.Save(&record) instead of silently returning nil, ensuring that error conditions are properly propagated.

Medium
确保释放数据库资源

新增了defer关闭prepared
statement的代码,这对防止数据库连接资源泄露非常重要。请检查所有类似数据库操作,确保每个使用PrepareNamed后都调用Close。

sqle/model/role_list.go [117-122]

     nameStmtTasksQuery, err := sqlxDb.PrepareNamed(selectQuery)
     if err != nil {
     	return err
     }
-+	defer nameStmtTasksQuery.Close()
+    defer nameStmtTasksQuery.Close()
     err = nameStmtTasksQuery.Select(result, data)
Suggestion importance[1-10]: 8

__

Why: The addition of defer nameStmtTasksQuery.Close() prevents potential resource leaks after preparing a statement, which is crucial for robust database handling.

Medium
保证错误传播

在数据库查询返回错误时,直接返回该错误以确保错误信息能够正确传递给上层调用,防止部分错误被忽略导致错误的数据处理。

sqle/driver/mysql/session/context.go [1428-1431]

     timeoutResults, err := c.e.Db.Query(timeoutQuery)
     if err != nil {
--		return count, 0, nil
-+		return count, 0, err
+    		return count, 0, err
     }
Suggestion importance[1-10]: 8

__

Why: By returning the error from c.e.Db.Query(timeoutQuery) instead of suppressing it, this suggestion ensures that errors are correctly bubbled up, aiding in proper error handling.

Medium

@github-actions
Copy link
Copy Markdown

Persistent review updated to latest commit a513907

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
返回保存错误

在通知记录保存时返回错误而不是nil,确保调用方能够正确捕获和处理保存失败的情况,避免错误被静默忽略带来潜在问题。

sqle/model/configuration.go [371-373]

     if err := s.Save(&record); err != nil {
--			return nil
-+			return err
+    		return err
     }
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly returns the error from s.Save(&record) instead of silently returning nil, ensuring that error conditions are properly propagated.

Medium
确保释放数据库资源

新增了defer关闭prepared
statement的代码,这对防止数据库连接资源泄露非常重要。请检查所有类似数据库操作,确保每个使用PrepareNamed后都调用Close。

sqle/model/role_list.go [117-122]

     nameStmtTasksQuery, err := sqlxDb.PrepareNamed(selectQuery)
     if err != nil {
     	return err
     }
-+	defer nameStmtTasksQuery.Close()
+    defer nameStmtTasksQuery.Close()
     err = nameStmtTasksQuery.Select(result, data)
Suggestion importance[1-10]: 8

__

Why: The addition of defer nameStmtTasksQuery.Close() prevents potential resource leaks after preparing a statement, which is crucial for robust database handling.

Medium
保证错误传播

在数据库查询返回错误时,直接返回该错误以确保错误信息能够正确传递给上层调用,防止部分错误被忽略导致错误的数据处理。

sqle/driver/mysql/session/context.go [1428-1431]

     timeoutResults, err := c.e.Db.Query(timeoutQuery)
     if err != nil {
--		return count, 0, nil
-+		return count, 0, err
+    		return count, 0, err
     }
Suggestion importance[1-10]: 8

__

Why: By returning the error from c.e.Db.Query(timeoutQuery) instead of suppressing it, this suggestion ensures that errors are correctly bubbled up, aiding in proper error handling.

Medium

@iwanghc iwanghc mentioned this pull request May 21, 2026
6 tasks
@LordofAvernus LordofAvernus merged commit a5b37fe into main May 21, 2026
4 checks 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