ttypes

package
v1.0.54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

View Source
const Md5 = "md5"
View Source
const Sha1 = "sha1"

Variables

View Source
var CrcMask = uint32(0xffffffff) >> 6
View Source
var ErrorFullChan = errors.New("full chan error")
View Source
var ErrorInvalidParameter = errors.New("invalid parameter")
View Source
var ErrorSliceNotEqualLength = errors.New("two slices not equal length")
View Source
var ErrorTimeout = errors.New("time out error")

Functions

func Greater added in v1.0.53

func Greater[T Ordered](a, b T) bool

Greater wraps the '>' operator for ordered types.

func GreaterEq added in v1.0.53

func GreaterEq[T Ordered](a, b T) bool

GreaterEq wraps the '>=' operator for ordered types.

func Less added in v1.0.53

func Less[T Ordered](a, b T) bool

Less wraps the '<' operator for ordered types.

func LessEq added in v1.0.53

func LessEq[T Ordered](a, b T) bool

LessEq wraps the '<=' operator for ordered types.

func OrderedCompare added in v1.0.53

func OrderedCompare[T Ordered](a, b T) int

OrderedCompare provide default CompareFn for ordered types.

func SetCRCMask

func SetCRCMask(n int)

Types

type CompareFn added in v1.0.17

type CompareFn[T any] func(a, b T) int

CompareFn is a function that return a compare to b

type ErrHandler

type ErrHandler func(err any)

type ErrorGroupHandler added in v1.0.47

type ErrorGroupHandler func() error

type FetchHandler

type FetchHandler[T any] func(context.Context, chan T)

type Float

type Float interface {
	~float32 | ~float64
}

type GreaterEqFn added in v1.0.53

type GreaterEqFn[T any] func(a, b T) bool

GreaterEqFn is a function that returns whether 'a' greater than or equal to 'b'.

type GreaterFn added in v1.0.53

type GreaterFn[T any] func(a, b T) bool

GreaterFn is a function that returns whether 'a' greater than 'b'.

type IComparator

type IComparator interface {
	Len() int
	Less(i, j int) bool
	Swap(i, j int)
}

type IFanOut

type IFanOut[T any] interface {
	Produce() chan T
	Compute(chan T) chan T
	Merge(...chan T) chan T
}

type ILimit

type ILimit interface {
	Put()
	Get()
}

type IPriorityChan

type IPriorityChan[T any] interface {
	Put(event T, t PriorityType)
	TryPut(event T, t PriorityType) error
	PutWithTimeout(event T, t PriorityType, timeout time.Duration) error
	Get() T
	TryGet() T
	GetWithTimeout(timeout time.Duration) (T, error)
	HandleSignal(highHandler PriorityHandler[T], lowHandler PriorityHandler[T]) error
}

type Integer

type Integer interface {
	Signed | Unsigned
}

type LessEqFn added in v1.0.53

type LessEqFn[T any] func(a, b T) bool

LessEqFn is a function that returns whether 'a' less than or equal to 'b'.

type LessFn added in v1.0.53

type LessFn[T any] func(a, b T) bool

LessFn is a function that returns whether 'a' is less than 'b'.

type OrderTuple added in v1.0.53

type OrderTuple[K Ordered, V any] struct {
	Key   K
	Value V
}

OrderTuple 有序元组,用于map的平铺,方便排序

type Ordered

type Ordered interface {
	Integer | Float | ~string
}

type PriorityHandler

type PriorityHandler[T any] func(event T) error

type PriorityType

type PriorityType int
const HighPriorityType PriorityType = 0
const LowPriorityType PriorityType = 1

type Signed

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

type Unsigned

type Unsigned interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type WaitGroupHandler

type WaitGroupHandler func()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL