Documentation ¶
Index ¶
- Constants
- func AllDone(ctx context.Context, fs ...func())
- func AnyDone(ctx context.Context, fs ...func() (res interface{}, needReturn bool)) (res interface{}, withNeedReturn bool)
- func Async(ctx context.Context, task func()) <-chan struct{}
- func CycleRun(f func(), handleFPanic func(interface{}), timeInterval time.Duration, ...) (cancel func())
- func ExternalIP() (net.IP, error)
- func Retry(f func(sn int) (end bool), times int, maxSleepTime time.Duration)
- func Stringer(obj interface{}) fmt.Stringer
- func TernaryInt(condi bool, ifTrue int, ifFalse int) int
- func TernaryInt16(condi bool, ifTrue int16, ifFalse int16) int16
- func TernaryInt16Slice(condi bool, ifTrue []int16, ifFalse []int16) []int16
- func TernaryInt32(condi bool, ifTrue int32, ifFalse int32) int32
- func TernaryInt32Slice(condi bool, ifTrue []int32, ifFalse []int32) []int32
- func TernaryInt64(condi bool, ifTrue int64, ifFalse int64) int64
- func TernaryInt64Slice(condi bool, ifTrue []int64, ifFalse []int64) []int64
- func TernaryInt8(condi bool, ifTrue int8, ifFalse int8) int8
- func TernaryInt8Slice(condi bool, ifTrue []int8, ifFalse []int8) []int8
- func TernaryIntSlice(condi bool, ifTrue []int, ifFalse []int) []int
- func TernaryString(condi bool, ifTrue string, ifFalse string) string
- func TernaryUint(condi bool, ifTrue uint, ifFalse uint) uint
- func TernaryUint16(condi bool, ifTrue uint16, ifFalse uint16) uint16
- func TernaryUint16Slice(condi bool, ifTrue []uint16, ifFalse []uint16) []uint16
- func TernaryUint8(condi bool, ifTrue uint8, ifFalse uint8) uint8
- func TernaryUint8Slice(condi bool, ifTrue []uint8, ifFalse []uint8) []uint8
- func TernaryUintSlice(condi bool, ifTrue []uint, ifFalse []uint) []uint
- func Traverse(root Node, multiRoutine bool)
- func TrimWhite(s string) string
- type Bar
- type BatchOutput
- func (b *BatchOutput) ChangeBatchSizeOrFlushTimeInterval(newBatchSize *uint64, newFlushTimeInterval *time.Duration) error
- func (b *BatchOutput) GetBatchElements(withBlock bool) ([]interface{}, error)
- func (b *BatchOutput) GetStatus() (BatchOutputStatus, error)
- func (b *BatchOutput) PushElement(x interface{}) error
- func (b *BatchOutput) Stop()
- type BatchOutputStatus
- type Node
Constants ¶
View Source
const ( Highlight = 1 FrontGreen = 32 BackBlack = 40 BasicCompletedIcon rune = '█' BasicUnCompletedIcon byte = ' ' )
Variables ¶
This section is empty.
Functions ¶
func AnyDone ¶
func AnyDone(ctx context.Context, fs ...func() (res interface{}, needReturn bool)) (res interface{}, withNeedReturn bool)
并发执行fs中的所有函数, 且在fs中某个函数最先返回(res0, true)时返回(res0, true), 如果fs中所有函数均返回(res, false), 则在fs中所有函数执行完之后返回(nil, false)
func CycleRun ¶
func CycleRun(f func(), handleFPanic func(interface{}), timeInterval time.Duration, maxRunTimes *uint64) (cancel func())
以周期timeInterval执行函数f, 调用cancel()可以停止周期执行任务, 多次调用cancel会panic
func ExternalIP ¶
func Stringer ¶
示例用法: logs.CtxDebug(ctx, "%v", xf.Stringer(obj))或logs.CtxDebug(ctx, "%s", xf.Stringer(obj))
func TernaryInt16Slice ¶
func TernaryInt32Slice ¶
func TernaryInt64Slice ¶
func TernaryUint16Slice ¶
func TernaryUint8Slice ¶
Types ¶
type BatchOutput ¶
type BatchOutput struct {
// contains filtered or unexported fields
}
func NewBatchOutput ¶
func NewBatchOutput(batchSize uint64, flushTimeInterval time.Duration) *BatchOutput
BatchOutput用于将输入元素聚合后输出, 主要参数为BatchSize和FlushTimeInterval, 含义如下:
BatchSize: 聚合的batch大小 FlushTimeInterval: 超过FlushTimeInterval时间内输入元素的个数未达到BatchSize时, 将当前剩余所有元素强制聚合后输出
func (*BatchOutput) ChangeBatchSizeOrFlushTimeInterval ¶
func (b *BatchOutput) ChangeBatchSizeOrFlushTimeInterval(newBatchSize *uint64, newFlushTimeInterval *time.Duration) error
func (*BatchOutput) GetBatchElements ¶
func (b *BatchOutput) GetBatchElements(withBlock bool) ([]interface{}, error)
func (*BatchOutput) GetStatus ¶
func (b *BatchOutput) GetStatus() (BatchOutputStatus, error)
func (*BatchOutput) PushElement ¶
func (b *BatchOutput) PushElement(x interface{}) error
func (*BatchOutput) Stop ¶
func (b *BatchOutput) Stop()
type BatchOutputStatus ¶
Click to show internal directories.
Click to hide internal directories.