Documentation
¶
Index ¶
- type ThresholdExecute
- func (exec *ThresholdExecute[ITEM]) AsyncExecute() *ThresholdExecute[ITEM]
- func (exec *ThresholdExecute[ITEM]) Collect(item ITEM)
- func (pe *ThresholdExecute[ITEM]) Stop()
- func (pe *ThresholdExecute[ITEM]) WithBatchSize(bsize int) *ThresholdExecute[ITEM]
- func (pe *ThresholdExecute[ITEM]) WithBatchSizeHandler(itemSizeDo func(i int, item ITEM)) *ThresholdExecute[ITEM]
- func (pe *ThresholdExecute[ITEM]) WithPeriodic(per time.Duration) *ThresholdExecute[ITEM]
- func (pe *ThresholdExecute[ITEM]) WithPeriodicHandler(itemPeriodicDo func(i int, item ITEM)) *ThresholdExecute[ITEM]
- func (pe *ThresholdExecute[ITEM]) WithRecover(recoverDo func(ierr any)) *ThresholdExecute[ITEM]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ThresholdExecute ¶
type ThresholdExecute[ITEM any] struct { // contains filtered or unexported fields }
ThresholdExecute 阈值执行, 超过阈值就执行. 必须调用AsyncExecute才能执行. 默认 batchsize 128 periodic 100ms
func NewThresholdExecute ¶
func NewThresholdExecute[ITEM any](itemDo func(i int, item ITEM)) *ThresholdExecute[ITEM]
func (*ThresholdExecute[ITEM]) AsyncExecute ¶ added in v0.1.0
func (exec *ThresholdExecute[ITEM]) AsyncExecute() *ThresholdExecute[ITEM]
AsyncExecute 返回自身. 方便与With设置连用
func (*ThresholdExecute[ITEM]) Collect ¶
func (exec *ThresholdExecute[ITEM]) Collect(item ITEM)
Collect 收集数据
func (*ThresholdExecute[ITEM]) WithBatchSize ¶ added in v0.1.0
func (pe *ThresholdExecute[ITEM]) WithBatchSize(bsize int) *ThresholdExecute[ITEM]
func (*ThresholdExecute[ITEM]) WithBatchSizeHandler ¶ added in v0.1.0
func (pe *ThresholdExecute[ITEM]) WithBatchSizeHandler(itemSizeDo func(i int, item ITEM)) *ThresholdExecute[ITEM]
func (*ThresholdExecute[ITEM]) WithPeriodic ¶ added in v0.1.0
func (pe *ThresholdExecute[ITEM]) WithPeriodic(per time.Duration) *ThresholdExecute[ITEM]
func (*ThresholdExecute[ITEM]) WithPeriodicHandler ¶ added in v0.1.0
func (pe *ThresholdExecute[ITEM]) WithPeriodicHandler(itemPeriodicDo func(i int, item ITEM)) *ThresholdExecute[ITEM]
func (*ThresholdExecute[ITEM]) WithRecover ¶ added in v0.1.0
func (pe *ThresholdExecute[ITEM]) WithRecover(recoverDo func(ierr any)) *ThresholdExecute[ITEM]
Click to show internal directories.
Click to hide internal directories.