feat(util/gexecutor): add new generic executor#4654
Open
LanceAdd wants to merge 4 commits into
Open
Conversation
- 实现了支持泛型的Executor结构体,可执行带前后置钩子的函数 - 提供New、WithMain、WithBefore、WithAfter和Do等核心方法 - 支持链式调用和模板复用功能 - 包含完整的单元测试覆盖基本功能、错误处理和复杂场景 - 提供中英文README文档说明使用方法和API接口
- 在 Executor 结构体中新增 onErrorFunc 字段用于错误处理 - 实现 WithOnError 方法用于设置错误处理器 - 在 Do 方法中添加错误检查逻辑,发生错误时调用错误处理器 - 更新文档说明 WithAfter 和 WithOnError 的执行条件差异 - 添加错误处理相关的单元测试用例 - 补充 README 中关于错误处理和闭包处理隐式输入的示例
Member
|
@LanceAdd 有几点疑问:
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: #4624
本次 PR 新增了
gexecutor组件,这是一个通用的执行器工具,用于简化函数执行流程的管理:✨ 新增功能
RWithBefore、WithMain、WithAfter链式配置ErrMainFuncNotSet错误定义🧪 测试覆盖
WithBefore测试WithAfter测试WithXxx方法返回新实例的特性,支持安全的执行器模板复用🔧 设计亮点
WithXxx调用返回新实例,不影响原始实例,支持模板复用WithXxx方法都是可选的,可根据需要灵活组合使用💡 使用场景