1 Star 2 Fork 3

kristas/booting-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
processor_def.go 587 Bytes
一键复制 编辑 原始数据 按行查看 历史
kristas 提交于 2021-05-14 00:24 . feat: better performance
package processor
import (
. "gitee.com/kristas/booting-go/framework/core/bean"
"gitee.com/kristas/booting-go/framework/core/bean_factory"
"gitee.com/kristas/booting-go/framework/core/configure"
"sync"
)
type Processor interface {
Filter(bean Bean) bool
Do(bean Bean)
}
func Run(processor Processor, bean ...Bean) {
var wg sync.WaitGroup
bean_factory.Autowired(processor)
configure.InjectStructure(processor)
wg.Add(len(bean))
for i := range bean {
go func(i int) {
b := bean[i]
if processor.Filter(b) {
processor.Do(b)
}
wg.Done()
}(i)
}
wg.Wait()
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kristas/booting-go.git
git@gitee.com:kristas/booting-go.git
kristas
booting-go
booting-go
v1.3.3

搜索帮助