Documentation
¶
Overview ¶
Package erxgroup provides generic wrapper around errgroup with type-safe custom error handling Enables using custom error types instead of standard error interface while maintaining errgroup semantics
Package erxgroup 提供 errgroup 的泛型包装,支持类型安全的自定义错误处理 允许使用自定义错误类型而非标准 error 接口,同时保持 errgroup 语义
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorType ¶
type ErrorType = constraint.ErrorType
ErrorType is an alias to the constraint defined in the internal package ErrorType 是内部包中定义的约束的别名
type Group ¶
type Group[E ErrorType] struct { // contains filtered or unexported fields }
Group wraps errgroup.Group with type-safe custom error handling Provides generic error type E instead of standard error interface Maintains context cancellation and goroutine synchronization semantics
Group 使用类型安全的自定义错误处理包装 errgroup.Group 提供泛型错误类型 E 而不是标准 error 接口 保持上下文取消和协程同步语义
func NewGroup ¶
NewGroup creates generic errgroup with custom error type Context cancels when first error occurs or parent context cancels
NewGroup 创建带有自定义错误类型的泛型 errgroup 当第一个错误发生或父上下文取消时,上下文会被取消
func (*Group[E]) Go ¶
Go starts goroutine within the group Converts custom error E to standard error when task fails Task receives shared cancellable context
Go 在组内启动协程 当任务失败时将自定义错误 E 转换为标准 error 任务接收共享的可取消上下文
func (*Group[E]) SetLimit ¶
SetLimit restricts concurrent goroutines count Must be invoked before first Go and TryGo invocation
SetLimit 限制并发协程数量 必须在第一次 Go 或 TryGo 调用之前调用