Documentation
¶
Index ¶
- Constants
- Variables
- func AlignCeil[Int constraints.Integer](value Int, base Int) Int
- func AlignFloor[Int constraints.Integer](value Int, base Int) Int
- func AllEqual[Datas ~[]Data, Data comparable](datas Datas, value Data) bool
- func AllMatch[Data any](datas []Data, test func(Data) bool) bool
- func AllMatchPro[Data any, Datas ~[]Data](datas Datas, test func(int, Data, Datas) bool) bool
- func AnyMatch[Data any](datas []Data, test func(Data) bool) bool
- func AnyMatchPro[Data any, Datas ~[]Data](datas Datas, test func(int, Data, Datas) bool) bool
- func Avg[Datas ~[]Data, Data Number](datas Datas) Data
- func Backmost[Datas ~[]Data, Data any](datas Datas, before func(a, b Data) bool) (result Data, index int)
- func BackmostPro[Datas ~[]Data, Data any](datas Datas, before func(a, b Data) bool) (result Data, index int)
- func BatchAssertType[Dst any, Source any, Sources ~[]Source](sources Sources) ([]Dst, bool)
- func BatchDeleteMap[Key comparable, Keys ~[]Key, Value any, Map ~map[Key]Value](m Map, keys Keys) Map
- func BatchDeleteMapFromAnother[Key comparable, Value any, Map ~map[Key]Value](m Map, keys Map) Map
- func BatchProcessUntilFirstError[Data any, Datas ~[]Data](datas Datas, f func(Data) error) error
- func BatchProcessUntilFirstErrorX[Data any](f func(Data) error, datas ...Data) error
- func Bisect[Datas ~[]Data, Data any](datas Datas, tester func(Data) bool) (trues Datas, falses Datas)
- func BisectByKeyAmbiguity[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) (unambiguous, ambiguous Datas)
- func BuildMap[Map ~map[Key]Value, Datas ~[]Data, Key comparable, Value any, Data any](datas Datas, kv func(data Data) (Key, Value)) Map
- func BuildMapPro[Map ~map[Key]Value, Datas ~[]Data, Key comparable, Value any, Data any](datas Datas, kv func(data Data) (Key, Value, bool, error)) (Map, error)
- func CacheMapValue[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, value Value) Value
- func CacheMapValueWithInitializer[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, initializer func() Value) Value
- func ChainUnaryHandler[Data any, Arg any](handler func(*Data, Arg)) func(*Data, Arg) *Data
- func Close(x any) error
- func CloseQuietly(x any)
- func Compare[Data constraints.Ordered](as []Data, bs []Data) int
- func ConcatMap[Key comparable, Value any, Map ~map[Key]Value](dst, src Map) Map
- func ConcatMapInplace[Map ~map[Key]Value, Key comparable, Value any](dst, src Map) Map
- func ConcatMaps[Map ~map[Key]Value, Key comparable, Value any](maps ...Map) Map
- func ConcatMapsTo[Map ~map[Key]Value, Key comparable, Value any](dst Map, maps ...Map) Map
- func ConcatSlices[Slice ~[]Data, Data any](slices ...Slice) Slice
- func ConcatSlicesTo[Data any, Slice ~[]Data](slice Slice, slices ...Slice) Slice
- func Contain[Datas ~[]Data, Data comparable](datas Datas, target Data) bool
- func ContainAll[Datas ~[]Data, Data comparable](datas Datas, targets ...Data) bool
- func ContainAny[Datas ~[]Data, Data comparable](datas Datas, targets ...Data) bool
- func CountAndMap[Number interface{ ... }, Mapper func(Number) Data, Data any](start, end, step Number, mapper Mapper) []Data
- func CountAndMapLite[Number interface{ ... }, Mapper func() Data, Data any](start, end, step Number, mapper Mapper) []Data
- func CountAndMapPro[Number interface{ ... }, Mapper func(Number, []Data) Data, Data any](start, end, step Number, mapper Mapper) []Data
- func DataSeq[Data any](datas ...Data) iter.Seq[Data]
- func Dereference[Ptr ~*Data, Data any](ptr Ptr) Data
- func Divide[Datas ~[]Data, Data any](datas Datas, size int, dup bool) (subs []Datas)
- func Dup[Data any, Ptr ~*Data](ptr Ptr) Ptr
- func DupMap[Key comparable, Value any, Map ~map[Key]Value](m Map) Map
- func DupSlice[Data any, Slice ~[]Data](slice Slice) Slice
- func Echo[Data any](data Data) Data
- func Echoer[T any](data T) func() T
- func EmptySeq[Data any](yield func(Data) bool)
- func EmptySeq2[K any, V any](yield func(K, V) bool)
- func EqualBySet[Data comparable](as []Data, bs []Data) bool
- func EqualBySort[Data constraints.Ordered](as []Data, bs []Data) bool
- func FillSliceToCap[Data any, Datas ~[]Data](datas Datas, g func(int) Data) Datas
- func Filter[Data any, Datas ~[]Data](datas Datas, filter func(Data) bool) Datas
- func FilterByKey[Datas ~[]Data, Data any, Key comparable](datas Datas, keyFunc func(Data) Key, key Key) Datas
- func FilterByKeySet[Datas ~[]Data, Data any, Key comparable](datas Datas, dataKey func(Data) Key, keySet Set[Key]) Datas
- func FilterByKeys[Datas ~[]Data, Data any, Key comparable](datas Datas, dataKey func(Data) Key, keys ...Key) Datas
- func FilterMap[Map ~map[Key]Value, Key comparable, Value any](m Map, tester func(Key, Value, Map) bool) Map
- func FilterMapByKey[Map ~map[Key]Value, Key comparable, Value any](m Map, f func(Key) bool) Map
- func FilterMapByValue[Map ~map[Key]Value, Key comparable, Value any](m Map, f func(Value) bool) Map
- func FilterPro[Data any, Datas ~[]Data](datas Datas, filter func(int, Data, Datas) bool) Datas
- func FilterZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
- func FindFirst[Datas ~[]Data, Data any](datas Datas, test func(Data) bool) (Data, bool)
- func FindFirstByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key) (result Data, ok bool)
- func FindFirstNotZero[Data comparable](datas []Data) Data
- func FindFirstOrDefault[Data any](datas []Data, test func(Data) bool, defaultData Data) Data
- func FindFirstOrDefaultByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key, default_ Data) Data
- func FindFirstOrZero[Data any](datas []Data, test func(Data) bool) Data
- func FindFirstOrZeroByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key) Data
- func FindLast[Datas ~[]Data, Data any](datas Datas, test func(Data) bool) (Data, bool)
- func FindLastOrDefault[Data any](datas []Data, test func(Data) bool, defaultData Data) Data
- func FindLastOrZero[Data any](datas []Data, test func(Data) bool) Data
- func FirstNotZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, keyFunc func(Data) Key) Key
- func FirstOneOrZero[Datas ~[]Data, Data any](datas Datas) (data Data)
- func ForEach[Data any](datas []Data, handler func(data Data))
- func ForEachBinary[Datas ~[]Data, Data any, Arg1 any, Arg2 any](datas Datas, handler func(Data, Arg1, Arg2), arg1 Arg1, arg2 Arg2)
- func ForEachBinaryByMapper[Datas ~[]Data, Data any, Arg1 any, Arg2 any, Result any](datas Datas, mapper func(Data, Arg1, Arg2) Result, arg1 Arg1, arg2 Arg2)
- func ForEachByMapper[Data any, Result any](datas []Data, mapper func(data Data) Result)
- func ForEachPro[Data any, Datas ~[]Data](datas Datas, handler func(i int, data Data, datas Datas))
- func ForEachTernary[Datas ~[]Data, Data any, Arg1 any, Arg2 any, Arg3 any](datas Datas, handler func(Data, Arg1, Arg2, Arg3), arg1 Arg1, arg2 Arg2, ...)
- func ForEachTernaryByMapper[Datas ~[]Data, Data any, Arg1 any, Arg2 any, Arg3 any, Result any](datas Datas, mapper func(Data, Arg1, Arg2, Arg3) Result, arg1 Arg1, arg2 Arg2, ...)
- func ForEachUnary[Datas ~[]Data, Data any, Arg any](datas Datas, handler func(Data, Arg), arg Arg)
- func ForEachUnaryByMapper[Datas ~[]Data, Data any, Arg any, Result any](datas Datas, mapper func(Data, Arg) Result, arg Arg)
- func GetCachedDataFetchLite[Func ~func(context.Context) (Data, error), Data any](cachedFetcher *CachedDataFetcher[Data]) Func
- func GetContextValue[Value any, Key any](ctx context.Context, key Key) (value Value)
- func GetSliceElemPointers[Data any, Datas ~[]Data](datas Datas) []*Data
- func Greater[Data constraints.Ordered](a, b Data) bool
- func Headmost[Datas ~[]Data, Data any](datas Datas, before func(a, b Data) bool) (result Data)
- func HeadmostPro[Datas ~[]Data, Data any](datas Datas, before func(a, b Data) bool) (result Data, index int)
- func Index[Data any](datas []Data, i int) (data Data, ok bool)
- func IndexDataSeq[Data any](datas ...Data) iter.Seq2[int, Data]
- func IndexOf[Data comparable](datas []Data, target Data) int
- func IndexOfKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key, target Key) int
- func InstancesToPointers[Data any, Instances ~[]Data](instances Instances) []*Data
- func IsNegativeNumber[Data Number](number Data) bool
- func IsPositiveNumber[Data Number](number Data) bool
- func JoinSlices[Slice ~[]Data, Data any](sep Slice, slices ...Slice) Slice
- func JoinSlicesTo[Slice ~[]Data, Data any](slice Slice, sep Slice, keepFirstSep bool, slices ...Slice) Slice
- func LastOneOrZero[Datas ~[]Data, Data any](datas Datas) (data Data)
- func Less[Data constraints.Ordered](a, b Data) bool
- func LookupContextValue[Value any, Key any](ctx context.Context, key Key) (value Value, ok bool)
- func Map[Datas ~[]Data, Result any, Data any](datas Datas, mapper func(Data) Result) []Result
- func MapAndConcat[Data any, Datas ~[]Data, Result any, Results ~[]Result](datas Datas, mapper func(Data) Results) Results
- func MapAndConcatWithError[Datas ~[]Data, Results ~[]Result, Data any, Result any](datas Datas, stopWhenError bool, mapper func(Data) (Results, error)) (Results, error)
- func MapAndJoinWithError[Datas ~[]Data, Results ~[]Result, Data any, Result any](datas Datas, sep Results, stopWhenError bool, ...) (Results, error)
- func MapArgs[Data any, Result any](mapper func(Data) Result, args ...Data) []Result
- func MapBinary[Datas ~[]Data, Data any, Arg1 any, Arg2 any, Result any](datas Datas, mapper func(Data, Arg1, Arg2) Result, arg1 Arg1, arg2 Arg2) []Result
- func MapIterator[Data any, Result any](it Iterator[Data], mapper func(Data) Result) []Result
- func MapKeys[Map ~map[Key]Value, Key comparable, Value any](m Map) []Key
- func MapMap[DstMap ~map[DstKey]DstValue, DstKey comparable, DstValue any, ...](m SrcMap, mapper func(SrcKey, SrvValue, SrcMap) (DstKey, DstValue)) DstMap
- func MapMapLite[Map ~map[Key]Value, Key comparable, Value any](m Map, mapper func(Key, Value, Map) (Key, Value)) Map
- func MapMapPro[DM ~map[DK]DV, SM ~map[SK]SV, SK comparable, SV any, DK comparable, DV any](sm SM, mapper func(sk SK, sv SV, sm SM, dm DM) (DK, DV, bool, error)) (DM, bool, error)
- func MapMapToSlice[Slice ~[]SliceItem, Map ~map[Key]Value, SliceItem any, Key comparable, ...](m Map, convert func(Key, Value, Map) SliceItem) Slice
- func MapMapToSlicePro[Slice ~[]SliceItem, Map ~map[Key]Value, SliceItem any, Key comparable, ...](m Map, convert func(Key, Value, Map) (SliceItem, bool, error)) (Slice, error)
- func MapPro[Data any, Datas ~[]Data, Result any](datas Datas, mapper func(int, Data, Datas) Result) []Result
- func MapProArgs[Data any, Datas ~[]Data, Result any](mapper func(int, Data, Datas) Result, datas ...Data) []Result
- func MapSeq[Data any, Result any](seq iter.Seq[Data], mapper func(Data) Result) []Result
- func MapTernary[Datas ~[]Data, Data any, Arg1 any, Arg2 any, Arg3 any, Result any](datas Datas, mapper func(Data, Arg1, Arg2, Arg3) Result, arg1 Arg1, arg2 Arg2, ...) []Result
- func MapToAssertedType[Dst any, Source any, Sources ~[]Source](sources Sources) (result []Dst)
- func MapUnary[Datas ~[]Data, Data any, Arg any, Result any](datas Datas, mapper func(Data, Arg) Result, arg Arg) []Result
- func MapUntilError[Datas ~[]Data, Result any, Data any](datas Datas, mapper func(Data) (Result, error)) ([]Result, error)
- func MapValueGetter[Key comparable, Value any, Map ~map[Key]Value](m Map) func(Key) Value
- func MapValueGetterPro[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) func(Key) (Value, bool)
- func MapValues[Key comparable, Value any, Map ~map[Key]Value](m Map) []Value
- func MapValuesByKeys[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) []Value
- func MapWithErrorSimplified[Datas ~[]Data, Result any, Data any](datas Datas, mapper func(Data) (Result, error)) ([]Result, error)
- func MappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Data
- func MappingByKeyPro[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(int, Data, Datas) Key) map[Key]Data
- func MappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Data
- func Max[Datas ~[]Data, Data constraints.Ordered](datas Datas, _default Data) (result Data)
- func Min[Datas ~[]Data, Data constraints.Ordered](datas Datas, _default Data) (result Data)
- func MultiSeq[Data any](seqs ...iter.Seq[Data]) iter.Seq[Data]
- func MultiSeq2[K any, V any](seqs ...iter.Seq2[K, V]) iter.Seq2[K, V]
- func MultivalueMap[Result ~map[Key]Values, Values ~[]Value, Map ~map[Key]Value, Key comparable, ...](m Map) Result
- func MustLookupContextValue[Value any, Key any](ctx context.Context, key Key) (value Value)
- func New[Data any]() (data Data)
- func NewAsAny[T any]() any
- func NewChanFromDatasX[DataChan ~chan Data, Data any](datas ...Data) DataChan
- func NewFirstWriteBuffer[Datas ~[]Data, Data any]() *reduceWriteBuffer[Datas, Data, Data]
- func NewLastWriteBuffer[Datas ~[]Data, Data any]() *reduceWriteBuffer[Datas, Data, Data]
- func NewPtr[Ptr ~*Data, Data any]() Ptr
- func NewReduceWriteBuffer[Datas ~[]Data, Data any, Result any](reduce func(result Result, data Data) Result) *reduceWriteBuffer[Datas, Data, Result]
- func NotGreater[Data constraints.Ordered](a, b Data) bool
- func NotLess[Data constraints.Ordered](a, b Data) bool
- func NotNilSlice[Datas ~[]Data, Data any](datas Datas) Datas
- func PopMap[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key) (value Value, ok bool)
- func Purge[Datas ~[]Data, Data any](datas Datas, filter func(Data) bool) Datas
- func PurgeMapKeys[Map ~map[Key]Value, Key comparable, Value any](m Map, keys ...Key) Map
- func PurgeMapZeroKey[Map ~map[Key]Value, Key comparable, Value any](m Map) Map
- func PurgeValue[Datas ~[]Data, Data comparable](datas Datas, value Data) Datas
- func PurgeZero[Datas ~[]Data, Data comparable](datas Datas) Datas
- func PurgeZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
- func PushDataToChanX[DataChan ~chan Data, Data any](dataChan DataChan, datas ...Data) DataChan
- func RandomOneOrZero[Datas ~[]Data, Data any](datas Datas, rand_ *rand.Rand) (data Data)
- func ReadAll[Datas ~[]Data, Data any](read func() (Data, error)) (Datas, error)
- func ReadChan[Data any](c chan Data, n int) []Data
- func ReadChanAll[Data any, Datas ~[]Data](c chan Data) (datas Datas)
- func Reduce[Data any, Datas ~[]Data, Result any](datas Datas, reducer func(Result, Data) Result, initial Result) (result Result)
- func ReducePro[Data any, Datas ~[]Data, Result any](datas Datas, reducer func(Result, Data, int, Datas) Result, initial Result) (result Result)
- func Reference[Data any](data Data) *Data
- func ReflectType[T any]() reflect.Type
- func Reverse[Datas ~[]Data, Data any](datas Datas) Datas
- func SeqDataErrorFromReader[Datas ~[]Data, Data any](r Reader[Datas, Data]) iter.Seq2[Data, error]
- func SeqFromReader[Datas ~[]Data, Data any](r Reader[Datas, Data]) iter.Seq[Data]
- func SetZero[Ptr ~*Data, Data any](ptr Ptr) Ptr
- func Shuffle[Datas ~[]Data, Data any](datas Datas, rand_ *rand.Rand) Datas
- func SingularDataSeq[Data any](data Data) iter.Seq[Data]
- func SingularIndexDataSeq[Data any](index int, data Data) iter.Seq2[int, Data]
- func SingularKeyValueSeq[K any, V any](key K, value V) iter.Seq2[K, V]
- func SliceEmpty[Datas ~[]Data, Data any](datas Datas) bool
- func SliceEqual[Datas ~[]Data, Data comparable](as Datas, bs Datas) bool
- func SliceLen[Datas ~[]Data, Data any](datas Datas) int
- func SliceMappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Datas
- func SliceMappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Datas
- func SliceNil[Datas ~[]Data, Data any](datas Datas) bool
- func Sort[Data any, Datas ~[]Data](datas Datas, less func(a, b Data) bool) Datas
- func SortByKey[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key, desc bool) Datas
- func SortByKeyAsc[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key) Datas
- func SortByKeyDesc[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key) Datas
- func SortFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas
- func SortUniqueFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas
- func StableUniqueBySet[Datas ~[]Data, Data comparable](datas Datas) Datas
- func SubMapByKeys[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) Map
- func Sum[Datas ~[]Data, Data Addend](datas Datas, start Data) Data
- func ToTypeless[Data any](data Data) any
- func ToTypelessSlice[Datas ~[]Data, Data any](datas Datas) []any
- func TypeAsserter[Dst any, Src any](src Src) (dst Dst, ok bool)
- func UnchainUnaryHandler[Data any, Arg any](handler func(Data, Arg) Data) func(Data, Arg)
- func Unique[Data comparable, Datas ~[]Data](datas Datas, equal func(Data, Data) bool) Datas
- func UniqueByKeySet[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
- func UniqueBySet[Data comparable, Datas ~[]Data](datas Datas) Datas
- func UniqueSorteds[Data comparable, Datas ~[]Data](datas Datas) Datas
- func UnmarshalJson[T any](raw []byte) (result T, err error)
- func WriteSeq[Datas ~[]Data, Data any](dst Writer[Datas, Data], seq iter.Seq[Data]) (int64, error)
- func WriteSeq2DataError[Datas ~[]Data, Data any](dst Writer[Datas, Data], seq iter.Seq2[Data, error]) (int64, error)
- func WriteSeq2Key[Datas ~[]Data, Data any](dst Writer[Datas, Data], seq iter.Seq2[Data, any]) (int64, error)
- func WriteSeq2Value[Datas ~[]Data, Data any](dst Writer[Datas, Data], seq iter.Seq2[any, Data]) (int64, error)
- func Zero[Data any]() (_ Data)
- type Added
- type Addend
- type BoundedBuffer
- func (lb *BoundedBuffer[Datas, Data]) Datas() Datas
- func (lb *BoundedBuffer[Datas, Data]) IsFull() bool
- func (lb *BoundedBuffer[Datas, Data]) IsTruncated() bool
- func (lb *BoundedBuffer[Datas, Data]) Reset()
- func (lb *BoundedBuffer[Datas, Data]) TotalWritten() int64
- func (lb *BoundedBuffer[Datas, Data]) Write(datas Datas) (n int, err error)
- type Buffer
- func (b *Buffer[Datas, Data]) Available() int
- func (b *Buffer[Datas, Data]) AvailableBuffer() Datas
- func (b *Buffer[Datas, Data]) Cap() int
- func (b *Buffer[Datas, Data]) Datas() Datas
- func (b *Buffer[Datas, Data]) Grow(n int)
- func (b *Buffer[Datas, Data]) Len() int
- func (b *Buffer[Datas, Data]) Next(n int) Datas
- func (b *Buffer[Datas, Data]) Read(p []Data) (n int, err error)
- func (b *Buffer[Datas, Data]) ReadFrom(r Reader[Datas, Data]) (n int64, err error)
- func (b *Buffer[Datas, Data]) ReadnFrom(r Reader[Datas, Data], n int) (read int, err error)
- func (b *Buffer[Datas, Data]) Reset()
- func (b *Buffer[Datas, Data]) Truncate(n int)
- func (b *Buffer[Datas, Data]) Write(datas Datas) (n int, err error)
- type CachedDataFetcher
- func NewCachedDataFetcher[Data any](fetcher CachedDataFetcherFetchFunc[Data]) *CachedDataFetcher[Data]
- func NewCachedDataFetcherFromAnother[Data any, BasedData any](basedFetcher *CachedDataFetcher[BasedData], ...) *CachedDataFetcher[Data]
- func NewCachedDataFetcherLite[Data any](fetcher CachedDataFetcherFetchFuncLite[Data]) *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) BuildAccessor() *CachedDataFetcherAccessor[Data]
- func (fetcher *CachedDataFetcher[Data]) Dup() *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) EnsureExpiresDuration(expiresDuration time.Duration) *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) Fetch(ctx context.Context) (Data, time.Time, error)
- func (fetcher *CachedDataFetcher[Data]) FetchLite(ctx context.Context) (data Data, err error)
- func (fetcher *CachedDataFetcher[Data]) FetchWithExpires(ctx context.Context, expiresDuration time.Duration) (data Data, t time.Time, err error)
- func (fetcher *CachedDataFetcher[Data]) FetchWithExpiresPro(ctx context.Context, expiresDuration, fallbackDuration time.Duration, ...) (data Data, ok bool)
- func (fetcher *CachedDataFetcher[Data]) FetchWithSince(ctx context.Context, since time.Time) (data Data, t time.Time, err error)
- func (fetcher *CachedDataFetcher[Data]) Get() (Data, time.Time, bool)
- func (fetcher *CachedDataFetcher[Data]) GetCached() (Data, time.Time)
- func (fetcher *CachedDataFetcher[Data]) GetFetch() func(ctx context.Context) (Data, time.Time, error)
- func (fetcher *CachedDataFetcher[Data]) GetFetchLite() func(ctx context.Context) (Data, error)
- func (fetcher *CachedDataFetcher[Data]) GetRefresh() func(ctx context.Context) (Data, time.Time, error)
- func (fetcher *CachedDataFetcher[Data]) GetWithExpires(expiresDuration time.Duration) (Data, time.Time, bool)
- func (fetcher *CachedDataFetcher[Data]) GetWithExpiresWarn(expiresDuration time.Duration) (Data, bool)
- func (fetcher *CachedDataFetcher[Data]) GetWithSince(since time.Time) (Data, time.Time, bool)
- func (fetcher *CachedDataFetcher[Data]) GetWithSinceWarn(since time.Time) (data Data, ok bool)
- func (fetcher *CachedDataFetcher[Data]) NewCallback(callback CachedDataFetcherCallbackFunc[Data], timeout time.Duration) *CachedDataFetcherCallback[Data]
- func (fetcher *CachedDataFetcher[Data]) NewCallbackLite(callback func(context.Context), timeout time.Duration) *CachedDataFetcherCallback[Data]
- func (fetcher *CachedDataFetcher[Data]) PurgeCachedData()
- func (fetcher *CachedDataFetcher[Data]) Refresh(ctx context.Context) (data Data, t time.Time, err error)
- func (fetcher *CachedDataFetcher[Data]) RefreshLowerCache(ctx context.Context) (data Data, t time.Time, err error)
- func (fetcher *CachedDataFetcher[Data]) RefreshWithSinceTime(ctx context.Context, since time.Time) (data Data, t time.Time, err error)
- func (fetcher *CachedDataFetcher[Data]) RegisterCallback(callback *CachedDataFetcherCallback[Data]) *CachedDataFetcherCallback[Data]
- func (fetcher *CachedDataFetcher[Data]) RegisterCallbackFunc(callback CachedDataFetcherCallbackFunc[Data], timeout time.Duration)
- func (fetcher *CachedDataFetcher[Data]) RegisterCallbackFuncLite(callback func(context.Context), timeout time.Duration)
- func (fetcher *CachedDataFetcher[Data]) SinceTimeFromExpiresDuration(expiresDuration time.Duration) (since time.Time)
- func (fetcher *CachedDataFetcher[Data]) TriggerRefreshLowerCache(ctx context.Context)
- func (fetcher *CachedDataFetcher[Data]) WithCachedDataPurged() *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) WithExpiresDuration(duration time.Duration) *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) WithFetcher(fetcherFunc CachedDataFetcherFetchFunc[Data]) *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) WithLogger(logger *zap.Logger) *CachedDataFetcher[Data]
- func (fetcher *CachedDataFetcher[Data]) WithOthersSubscribed(timeout time.Duration, others ...) *CachedDataFetcher[Data]
- type CachedDataFetcherAccessor
- func (getter *CachedDataFetcherAccessor[Data]) Dup() *CachedDataFetcherAccessor[Data]
- func (getter *CachedDataFetcherAccessor[Data]) Get() (data Data, ok bool)
- func (getter *CachedDataFetcherAccessor[Data]) GetLogger() *zap.Logger
- func (getter *CachedDataFetcherAccessor[Data]) WithExpiresDuration(expiresDuration time.Duration) *CachedDataFetcherAccessor[Data]
- func (getter *CachedDataFetcherAccessor[Data]) WithFallbackDuration(fallbackDuration time.Duration) *CachedDataFetcherAccessor[Data]
- func (getter *CachedDataFetcherAccessor[Data]) WithLogExpired(logExpired bool) *CachedDataFetcherAccessor[Data]
- func (getter *CachedDataFetcherAccessor[Data]) WithLogger(logger *zap.Logger) *CachedDataFetcherAccessor[Data]
- type CachedDataFetcherCallback
- type CachedDataFetcherCallbackFunc
- type CachedDataFetcherCallbacks
- type CachedDataFetcherFetchFunc
- type CachedDataFetcherFetchFuncLite
- type ChanPipe
- type CloseFunc
- type Closers
- type ComparableSlice
- func (slice ComparableSlice[Data]) AllMatch(f func(Data) bool) bool
- func (slice ComparableSlice[Data]) AnyMatch(f func(Data) bool) bool
- func (slice ComparableSlice[Data]) Contain(data Data) bool
- func (slice ComparableSlice[Data]) ContainAll(datas ...Data) bool
- func (slice ComparableSlice[Data]) ContainAny(datas ...Data) bool
- func (slice ComparableSlice[Data]) Dup() ComparableSlice[Data]
- func (slice ComparableSlice[Data]) Filter(f func(Data) bool) ComparableSlice[Data]
- func (slice ComparableSlice[Data]) ForEachPro(f func(int, Data, ComparableSlice[Data]))
- func (slice ComparableSlice[Data]) Map(f func(Data) Data) Slice[Data]
- func (slice ComparableSlice[Data]) Native() []Data
- func (slice ComparableSlice[Data]) NotNilSlice() ComparableSlice[Data]
- type ContextValues
- type ConvertWriter
- type CountWriter
- type Counter
- func (counter Counter[Key]) Decrease(key Key) Counter[Key]
- func (counter Counter[Key]) Increase(key Key) Counter[Key]
- func (counter Counter[Key]) IncreaseValue(key Key, value int) Counter[Key]
- func (counter Counter[Key]) NativeMap() map[Key]int
- func (counter Counter[Key]) SumKeys(keys ...Key) (total int)
- type Errors
- func MapWithError[Datas ~[]Data, Result any, Data any](datas Datas, stopWhenError bool, mapper func(Data) (Result, error)) (results []Result, errs Errors)
- func MapWithErrorPro[Datas ~[]Data, Result any, Data any](datas Datas, stopWhenError bool, mapper func(int, Data, Datas) (Result, error)) (results []Result, errs Errors)
- func NewErrors(errs ...error) Errors
- func (errors Errors) Append(more ...error) Errors
- func (errors Errors) Concat(mores ...Errors) Errors
- func (errors Errors) Empty() bool
- func (errors Errors) Error() string
- func (errors Errors) FirstError() error
- func (errors Errors) FirstOneOrZero() error
- func (errors Errors) Len() int
- func (errors Errors) PurgeZero() Errors
- func (errors Errors) Simplify() error
- type IntOptionMeta
- type IntOptionMetas
- type Iterator
- type KeyValuePair
- func (pair *KeyValuePair[Key, Value]) GetKey() (key Key)
- func (pair *KeyValuePair[Key, Value]) GetKeyValue() (key Key, value Value)
- func (pair *KeyValuePair[Key, Value]) GetValue() (value Value)
- func (pair *KeyValuePair[Key, Value]) KeySeq() iter.Seq[Key]
- func (pair *KeyValuePair[Key, Value]) KeyValueSeq() iter.Seq2[Key, Value]
- func (pair *KeyValuePair[Key, Value]) ValueSeq() iter.Seq[Value]
- type KeyValuePairPtrs
- type KeyValuePairs
- func (pairs KeyValuePairs[Key, Value]) Append(others ...KeyValuePair[Key, Value]) KeyValuePairs[Key, Value]
- func (pairs KeyValuePairs[Key, Value]) KeySeq() iter.Seq[Key]
- func (pairs KeyValuePairs[Key, Value]) KeyValueSeq() iter.Seq2[Key, Value]
- func (pairs KeyValuePairs[Key, Value]) Sort(less func(a, b KeyValuePair[Key, Value]) bool) KeyValuePairs[Key, Value]
- func (pairs KeyValuePairs[Key, Value]) SortByKey(less func(a, b Key) bool) KeyValuePairs[Key, Value]
- func (pairs KeyValuePairs[Key, Value]) SortByValue(less func(a, b Value) bool) KeyValuePairs[Key, Value]
- func (pairs KeyValuePairs[Key, Value]) ToTypelessSlice() []any
- func (pairs KeyValuePairs[Key, Value]) ValueSeq() iter.Seq[Value]
- type LimitWriter
- type MapWriter
- type Mapping
- func (m Mapping[Key, Value]) Clear()
- func (m Mapping[Key, Value]) Delete(key Key)
- func (m Mapping[Key, Value]) Get(key Key) (_ Value)
- func (mapping Mapping[Key, Value]) KeyValuePairs() KeyValuePairs[Key, Value]
- func (mapping Mapping[Key, Value]) Keys() []Key
- func (m Mapping[Key, Value]) Len() int
- func (m Mapping[Key, Value]) Load(key Key) (Value, bool)
- func (m Mapping[Key, Value]) LoadAndDelete(key Key) (value Value, ok bool)
- func (m Mapping[Key, Value]) LoadOrCreate(key Key, create func() Value) (Value, bool)
- func (m Mapping[Key, Value]) LoadOrStore(key Key, value Value) (Value, bool)
- func (mapping Mapping[Key, Value]) Native() map[Key]Value
- func (m Mapping[Key, Value]) Store(key Key, value Value)
- func (m Mapping[Key, Value]) StoreOk(key Key, value Value) (ok bool)
- func (m Mapping[Key, Value]) Swap(key Key, value Value) (Value, bool)
- func (m Mapping[Key, Value]) SwapOk(key Key, value Value) (previous Value, loaded bool, ok bool)
- func (m Mapping[Key, Value]) Values() []Value
- type NilNopCloseFunc
- type NilNopWriteFunc
- type NoOpIo
- type NopCloser
- type NopWriteCloser
- type NopWriter
- type Number
- type Numbers
- func (numbers Numbers[Data]) Append(others ...Data) Numbers[Data]
- func (numbers Numbers[Data]) AscPercentFor(target Data) float64
- func (numbers Numbers[Data]) AscPositionFor(target Data) int
- func (numbers Numbers[Data]) AscRatioFor(target Data) float64
- func (numbers Numbers[Data]) Avg() Data
- func (numbers Numbers[Data]) Concat(others ...Numbers[Data]) Numbers[Data]
- func (numbers Numbers[Data]) DescPercentFor(target Data) float64
- func (numbers Numbers[Data]) DescPositionFor(target Data) int
- func (numbers Numbers[Data]) DescRatioFor(target Data) float64
- func (numbers Numbers[Data]) Dup() Numbers[Data]
- func (numbers Numbers[Data]) Empty() bool
- func (numbers Numbers[Data]) Len() int
- func (numbers Numbers[Data]) Max() Data
- func (numbers Numbers[Data]) Min() Data
- func (numbers Numbers[Data]) Negtives() Numbers[Data]
- func (numbers Numbers[Data]) Positives() Numbers[Data]
- func (numbers Numbers[Data]) PurgeZero() Numbers[Data]
- func (numbers Numbers[Data]) Sort() Numbers[Data]
- func (numbers Numbers[Data]) SortAsc() Numbers[Data]
- func (numbers Numbers[Data]) SortDesc() Numbers[Data]
- func (numbers Numbers[Data]) SortPro(less func(a, b Data) bool) Numbers[Data]
- func (numbers Numbers[Data]) Sum() Data
- type Option
- type Options
- type PeekReader
- type PipeParser
- type ProcessWriter
- type ReadCloser
- type Reader
- type ReduceWriter
- type ResumeReader
- type RingBuffer
- type Seq2s
- type SeqReader
- type Seqs
- type Set
- func (set Set[Data]) Add(data Data) Set[Data]
- func (set Set[Data]) AddX(datas ...Data) Set[Data]
- func (set Set[Data]) Contain(data Data) bool
- func (set Set[Data]) ContainAll(datas ...Data) bool
- func (set Set[Data]) ContainAny(datas ...Data) bool
- func (set Set[Data]) Difference(other Set[Data]) Set[Data]
- func (set Set[Data]) Dup() Set[Data]
- func (set Set[Data]) Empty() bool
- func (set Set[Data]) Equal(other Set[Data]) bool
- func (set Set[Data]) FirstAppear(datas ...Data) (result Data)
- func (set Set[Data]) Intersection(other Set[Data]) Set[Data]
- func (set Set[Data]) Len() int
- func (set Set[Data]) Merge(other Set[Data]) Set[Data]
- func (set Set[Data]) Pop(data Data) Set[Data]
- func (set Set[Data]) Purge(other Set[Data]) Set[Data]
- func (set Set[Data]) Push(data Data) Set[Data]
- func (set Set[Data]) PushX(datas ...Data) Set[Data]
- func (set Set[Data]) Slice() Slice[Data]
- func (set Set[Data]) SymmetricDifference(other Set[Data]) Set[Data]
- func (set Set[Data]) Union(other Set[Data]) Set[Data]
- type SkipWriter
- type Slice
- func (slice Slice[Data]) AllMatch(f func(Data) bool) bool
- func (slice Slice[Data]) AnyMatch(f func(Data) bool) bool
- func (slice Slice[Data]) Append(datas ...Data) Slice[Data]
- func (slice Slice[Data]) Concat(others ...Slice[Data]) Slice[Data]
- func (slice Slice[Data]) DataSeq() iter.Seq[Data]
- func (slice Slice[Data]) Dup() Slice[Data]
- func (slice Slice[Data]) Empty() bool
- func (slice Slice[Data]) Filter(f func(Data) bool) Slice[Data]
- func (slice Slice[Data]) FilterPro(f func(int, Data, Slice[Data]) bool) Slice[Data]
- func (slice Slice[Data]) ForEach(f func(Data))
- func (slice Slice[Data]) ForEachPro(f func(int, Data, Slice[Data]))
- func (slice Slice[Data]) IndexDataSeq() iter.Seq2[int, Data]
- func (slice Slice[Data]) IndexSeq() iter.Seq[int]
- func (slice Slice[Data]) Len() int
- func (slice Slice[Data]) Map(f func(Data) Data) Slice[Data]
- func (slice Slice[Data]) MapPro(f func(int, Data, Slice[Data]) Data) Slice[Data]
- func (slice Slice[Data]) Native() []Data
- func (slice Slice[Data]) NotNilSlice() Slice[Data]
- type SyncMap
- func (m *SyncMap[Key, Value]) Clear()
- func (m *SyncMap[Key, Value]) Delete(key Key)
- func (m *SyncMap[Key, Value]) Empty() bool
- func (m *SyncMap[Key, Value]) Get(key Key) Value
- func (m *SyncMap[Key, Value]) Keys() []Key
- func (m *SyncMap[Key, Value]) Len() int
- func (m *SyncMap[Key, Value]) Load(key Key) (value Value, loaded bool)
- func (m *SyncMap[Key, Value]) LoadAndDelete(key Key) (value Value, loaded bool)
- func (m *SyncMap[Key, Value]) LoadOrCreate(ctx context.Context, key Key, ...) (value Value, loaded bool, err error)
- func (m *SyncMap[Key, Value]) LoadOrCreateLite(ctx context.Context, key Key, create func() Value) (Value, bool)
- func (m *SyncMap[Key, Value]) LoadOrStore(key Key, newValue Value) (value Value, loaded bool)
- func (m *SyncMap[Key, Value]) Native() map[Key]Value
- func (m *SyncMap[Key, Value]) Store(key Key, value Value)
- func (m *SyncMap[Key, Value]) StoreOk(key Key, value Value) (ok bool)
- func (m *SyncMap[Key, Value]) Swap(key Key, value Value) (Value, bool)
- func (m *SyncMap[Key, Value]) SwapMapping(new Mapping[Key, Value]) Mapping[Key, Value]
- func (m *SyncMap[Key, Value]) SwapOk(key Key, value Value) (old Value, hasOld bool, ok bool)
- func (m *SyncMap[Key, Value]) Values() []Value
- type TimedValue
- type TruncatedBuffer
- type UnaryWriteFunc
- type WriteBuffer
- type WriteCloser
- type WriteClosers
- type WriteFunc
- type Writer
- type Writers
- func (writers Writers[Datas, Data]) Append(others ...Writer[Datas, Data]) Writers[Datas, Data]
- func (writers Writers[Datas, Data]) Close() error
- func (writers Writers[Datas, Data]) Closers() Closers
- func (writers Writers[Datas, Data]) MultiWriter() Writer[Datas, Data]
- func (writers Writers[Datas, Data]) Native() []Writer[Datas, Data]
- func (writers Writers[Datas, Data]) PurgeNil() Writers[Datas, Data]
- func (writers Writers[Datas, Data]) ValidClosers() Closers
- func (writers Writers[Datas, Data]) Write(datas Datas) (n int, err error)
Constants ¶
const MinRead = 512
MinRead 与 bytes.Buffer 一致:ReadFrom 单次至少向 r 预留这么多容量,减少扩容次数。
Variables ¶
var ErrTooLarge = errors.New("stl.Buffer: too large")
ErrTooLarge 在无法为缓冲区分配足够内存时由 grow 触发 panic 的值(与 bytes.Buffer 语义一致)。
var (
NopLogger = zap.NewNop()
)
Functions ¶
func AlignCeil ¶ added in v1.1.3
func AlignCeil[Int constraints.Integer](value Int, base Int) Int
func AlignFloor ¶ added in v1.1.3
func AlignFloor[Int constraints.Integer](value Int, base Int) Int
func AllEqual ¶ added in v1.0.77
func AllEqual[Datas ~[]Data, Data comparable](datas Datas, value Data) bool
func AllMatchPro ¶ added in v1.0.3
func AnyMatchPro ¶ added in v1.0.3
func BackmostPro ¶ added in v1.0.32
func BatchAssertType ¶ added in v1.0.61
func BatchDeleteMap ¶
func BatchDeleteMap[Key comparable, Keys ~[]Key, Value any, Map ~map[Key]Value](m Map, keys Keys) Map
func BatchDeleteMapFromAnother ¶
func BatchDeleteMapFromAnother[Key comparable, Value any, Map ~map[Key]Value](m Map, keys Map) Map
func BatchProcessUntilFirstError ¶ added in v1.0.44
func BatchProcessUntilFirstErrorX ¶ added in v1.0.90
func BisectByKeyAmbiguity ¶ added in v1.0.63
func BisectByKeyAmbiguity[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) (unambiguous, ambiguous Datas)
func BuildMap ¶ added in v1.0.18
func BuildMap[Map ~map[Key]Value, Datas ~[]Data, Key comparable, Value any, Data any](datas Datas, kv func(data Data) (Key, Value)) Map
func BuildMapPro ¶ added in v1.0.18
func CacheMapValue ¶ added in v1.0.8
func CacheMapValue[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, value Value) Value
func CacheMapValueWithInitializer ¶ added in v1.0.8
func CacheMapValueWithInitializer[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key, initializer func() Value) Value
func ChainUnaryHandler ¶ added in v1.0.46
func CloseQuietly ¶ added in v1.1.8
func CloseQuietly(x any)
func Compare ¶ added in v1.0.8
func Compare[Data constraints.Ordered](as []Data, bs []Data) int
func ConcatMap ¶
func ConcatMap[Key comparable, Value any, Map ~map[Key]Value](dst, src Map) Map
func ConcatMapInplace ¶
func ConcatMapInplace[Map ~map[Key]Value, Key comparable, Value any](dst, src Map) Map
func ConcatMaps ¶ added in v1.0.40
func ConcatMaps[Map ~map[Key]Value, Key comparable, Value any](maps ...Map) Map
func ConcatMapsTo ¶ added in v1.0.40
func ConcatMapsTo[Map ~map[Key]Value, Key comparable, Value any](dst Map, maps ...Map) Map
func ConcatSlices ¶
func ConcatSlices[Slice ~[]Data, Data any](slices ...Slice) Slice
func ConcatSlicesTo ¶
func ConcatSlicesTo[Data any, Slice ~[]Data](slice Slice, slices ...Slice) Slice
func Contain ¶ added in v1.0.47
func Contain[Datas ~[]Data, Data comparable](datas Datas, target Data) bool
func ContainAll ¶ added in v1.0.61
func ContainAll[Datas ~[]Data, Data comparable](datas Datas, targets ...Data) bool
func ContainAny ¶ added in v1.0.61
func ContainAny[Datas ~[]Data, Data comparable](datas Datas, targets ...Data) bool
func CountAndMap ¶ added in v1.0.44
func CountAndMap[
Number interface {
constraints.Integer | constraints.Float
},
Mapper func(Number) Data,
Data any,
](start, end, step Number, mapper Mapper) []Data
func CountAndMapLite ¶ added in v1.0.44
func CountAndMapLite[
Number interface {
constraints.Integer | constraints.Float
},
Mapper func() Data,
Data any,
](start, end, step Number, mapper Mapper) []Data
func CountAndMapPro ¶ added in v1.0.44
func CountAndMapPro[
Number interface {
constraints.Integer | constraints.Float
},
Mapper func(Number, []Data) Data,
Data any,
](start, end, step Number, mapper Mapper) []Data
func Dereference ¶ added in v1.0.35
func Dereference[Ptr ~*Data, Data any](ptr Ptr) Data
func DupMap ¶
func DupMap[Key comparable, Value any, Map ~map[Key]Value](m Map) Map
func EqualBySet ¶ added in v1.0.8
func EqualBySet[Data comparable](as []Data, bs []Data) bool
func EqualBySort ¶ added in v1.0.8
func EqualBySort[Data constraints.Ordered](as []Data, bs []Data) bool
func FillSliceToCap ¶ added in v1.0.8
func FilterByKey ¶ added in v1.0.77
func FilterByKey[Datas ~[]Data, Data any, Key comparable](datas Datas, keyFunc func(Data) Key, key Key) Datas
func FilterByKeySet ¶ added in v1.0.68
func FilterByKeySet[Datas ~[]Data, Data any, Key comparable](datas Datas, dataKey func(Data) Key, keySet Set[Key]) Datas
func FilterByKeys ¶ added in v1.0.67
func FilterByKeys[Datas ~[]Data, Data any, Key comparable](datas Datas, dataKey func(Data) Key, keys ...Key) Datas
func FilterMap ¶ added in v1.0.28
func FilterMap[Map ~map[Key]Value, Key comparable, Value any](m Map, tester func(Key, Value, Map) bool) Map
func FilterMapByKey ¶ added in v1.0.61
func FilterMapByKey[Map ~map[Key]Value, Key comparable, Value any](m Map, f func(Key) bool) Map
func FilterMapByValue ¶ added in v1.0.61
func FilterMapByValue[Map ~map[Key]Value, Key comparable, Value any](m Map, f func(Value) bool) Map
func FilterZeroKey ¶ added in v1.0.63
func FilterZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
func FindFirstByKey ¶ added in v1.0.67
func FindFirstByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key) (result Data, ok bool)
func FindFirstNotZero ¶ added in v1.0.26
func FindFirstNotZero[Data comparable](datas []Data) Data
func FindFirstOrDefault ¶ added in v1.0.23
func FindFirstOrDefaultByKey ¶ added in v1.0.67
func FindFirstOrDefaultByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key, default_ Data) Data
func FindFirstOrZero ¶ added in v1.0.23
func FindFirstOrZeroByKey ¶ added in v1.0.67
func FindFirstOrZeroByKey[Datas ~[]Data, Key comparable, Data any](datas Datas, keyFunc func(Data) Key, key Key) Data
func FindLastOrDefault ¶ added in v1.0.22
func FindLastOrZero ¶ added in v1.0.22
func FirstNotZeroKey ¶ added in v1.1.22
func FirstNotZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, keyFunc func(Data) Key) Key
func FirstOneOrZero ¶ added in v1.0.26
func FirstOneOrZero[Datas ~[]Data, Data any](datas Datas) (data Data)
func ForEachBinary ¶ added in v1.1.7
func ForEachBinaryByMapper ¶ added in v1.1.7
func ForEachByMapper ¶ added in v1.0.55
func ForEachPro ¶ added in v1.0.3
func ForEachTernary ¶ added in v1.1.7
func ForEachTernaryByMapper ¶ added in v1.1.7
func ForEachUnary ¶ added in v1.1.7
func ForEachUnaryByMapper ¶ added in v1.1.7
func GetCachedDataFetchLite ¶ added in v1.1.7
func GetCachedDataFetchLite[ Func ~func(context.Context) (Data, error), Data any, ](cachedFetcher *CachedDataFetcher[Data]) Func
func GetContextValue ¶ added in v1.0.56
func GetSliceElemPointers ¶
func GetSliceElemPointers[Data any, Datas ~[]Data](datas Datas) []*Data
func Greater ¶ added in v1.1.8
func Greater[Data constraints.Ordered](a, b Data) bool
func HeadmostPro ¶ added in v1.0.32
func IndexOf ¶
func IndexOf[Data comparable](datas []Data, target Data) int
func IndexOfKey ¶ added in v1.1.22
func IndexOfKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key, target Key) int
func InstancesToPointers ¶
func InstancesToPointers[Data any, Instances ~[]Data](instances Instances) []*Data
func IsNegativeNumber ¶ added in v1.1.8
func IsPositiveNumber ¶ added in v1.1.8
func JoinSlices ¶ added in v1.0.26
func JoinSlices[Slice ~[]Data, Data any](sep Slice, slices ...Slice) Slice
func JoinSlicesTo ¶ added in v1.0.26
func LastOneOrZero ¶ added in v1.0.31
func LastOneOrZero[Datas ~[]Data, Data any](datas Datas) (data Data)
func Less ¶ added in v1.1.8
func Less[Data constraints.Ordered](a, b Data) bool
func LookupContextValue ¶ added in v1.0.56
func MapAndConcat ¶
func MapAndConcatWithError ¶ added in v1.0.26
func MapAndJoinWithError ¶ added in v1.0.26
func MapBinary ¶ added in v1.1.7
func MapBinary[ Datas ~[]Data, Data any, Arg1 any, Arg2 any, Result any, ](datas Datas, mapper func(Data, Arg1, Arg2) Result, arg1 Arg1, arg2 Arg2) []Result
✅ 带两个参数的映射
func MapIterator ¶ added in v1.0.35
func MapKeys ¶
func MapKeys[Map ~map[Key]Value, Key comparable, Value any](m Map) []Key
func MapMap ¶ added in v1.0.27
func MapMap[DstMap ~map[DstKey]DstValue, DstKey comparable, DstValue any, SrcMap ~map[SrcKey]SrvValue, SrcKey comparable, SrvValue any](m SrcMap, mapper func(SrcKey, SrvValue, SrcMap) (DstKey, DstValue)) DstMap
func MapMapLite ¶ added in v1.0.44
func MapMapLite[Map ~map[Key]Value, Key comparable, Value any](m Map, mapper func(Key, Value, Map) (Key, Value)) Map
func MapMapPro ¶ added in v1.0.53
func MapMapPro[DM ~map[DK]DV, SM ~map[SK]SV, SK comparable, SV any, DK comparable, DV any](sm SM, mapper func(sk SK, sv SV, sm SM, dm DM) (DK, DV, bool, error)) (DM, bool, error)
func MapMapToSlice ¶ added in v1.0.27
func MapMapToSlice[Slice ~[]SliceItem, Map ~map[Key]Value, SliceItem any, Key comparable, Value any](m Map, convert func(Key, Value, Map) SliceItem) Slice
func MapMapToSlicePro ¶ added in v1.0.27
func MapProArgs ¶ added in v1.0.3
func MapTernary ¶ added in v1.1.7
func MapTernary[ Datas ~[]Data, Data any, Arg1 any, Arg2 any, Arg3 any, Result any, ](datas Datas, mapper func(Data, Arg1, Arg2, Arg3) Result, arg1 Arg1, arg2 Arg2, arg3 Arg3) []Result
✅ 带三个参数的映射
func MapToAssertedType ¶ added in v1.0.61
func MapUnary ¶ added in v1.1.7
func MapUnary[ Datas ~[]Data, Data any, Arg any, Result any, ](datas Datas, mapper func(Data, Arg) Result, arg Arg) []Result
✅ 带一个参数的映射
func MapUntilError ¶ added in v1.0.95
func MapValueGetter ¶ added in v1.0.17
func MapValueGetter[Key comparable, Value any, Map ~map[Key]Value](m Map) func(Key) Value
func MapValueGetterPro ¶ added in v1.0.17
func MapValueGetterPro[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) func(Key) (Value, bool)
func MapValues ¶ added in v1.0.6
func MapValues[Key comparable, Value any, Map ~map[Key]Value](m Map) []Value
func MapValuesByKeys ¶ added in v1.0.6
func MapValuesByKeys[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) []Value
func MapWithErrorSimplified ¶ added in v1.0.77
func MappingByKey ¶
func MappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Data
func MappingByKeyPro ¶ added in v1.0.3
func MappingByKeyPro[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(int, Data, Datas) Key) map[Key]Data
func MappingByKeys ¶
func MappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Data
func Max ¶ added in v1.0.19
func Max[Datas ~[]Data, Data constraints.Ordered](datas Datas, _default Data) (result Data)
func Min ¶ added in v1.0.19
func Min[Datas ~[]Data, Data constraints.Ordered](datas Datas, _default Data) (result Data)
func MultivalueMap ¶ added in v1.0.43
func MultivalueMap[Result ~map[Key]Values, Values ~[]Value, Map ~map[Key]Value, Key comparable, Value any](m Map) Result
func MustLookupContextValue ¶ added in v1.0.56
func NewChanFromDatasX ¶ added in v1.0.78
func NewChanFromDatasX[DataChan ~chan Data, Data any](datas ...Data) DataChan
func NewFirstWriteBuffer ¶ added in v1.1.18
func NewFirstWriteBuffer[Datas ~[]Data, Data any]() *reduceWriteBuffer[Datas, Data, Data]
func NewLastWriteBuffer ¶ added in v1.1.18
func NewLastWriteBuffer[Datas ~[]Data, Data any]() *reduceWriteBuffer[Datas, Data, Data]
func NewReduceWriteBuffer ¶ added in v1.1.18
func NotGreater ¶ added in v1.1.8
func NotGreater[Data constraints.Ordered](a, b Data) bool
func NotLess ¶ added in v1.1.8
func NotLess[Data constraints.Ordered](a, b Data) bool
func NotNilSlice ¶ added in v1.1.7
func NotNilSlice[Datas ~[]Data, Data any](datas Datas) Datas
func PopMap ¶
func PopMap[Key comparable, Value any, Map ~map[Key]Value](m Map, key Key) (value Value, ok bool)
func PurgeMapKeys ¶ added in v1.0.47
func PurgeMapKeys[Map ~map[Key]Value, Key comparable, Value any](m Map, keys ...Key) Map
func PurgeMapZeroKey ¶ added in v1.0.47
func PurgeMapZeroKey[Map ~map[Key]Value, Key comparable, Value any](m Map) Map
func PurgeValue ¶
func PurgeValue[Datas ~[]Data, Data comparable](datas Datas, value Data) Datas
func PurgeZero ¶
func PurgeZero[Datas ~[]Data, Data comparable](datas Datas) Datas
func PurgeZeroKey ¶ added in v1.0.58
func PurgeZeroKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
func PushDataToChanX ¶ added in v1.0.78
func PushDataToChanX[DataChan ~chan Data, Data any](dataChan DataChan, datas ...Data) DataChan
func RandomOneOrZero ¶ added in v1.0.90
func ReadChanAll ¶ added in v1.0.8
func ReadChanAll[Data any, Datas ~[]Data](c chan Data) (datas Datas)
func ReflectType ¶ added in v1.0.48
func SeqDataErrorFromReader ¶ added in v1.1.6
func SeqFromReader ¶ added in v1.1.6
func SingularDataSeq ¶ added in v1.1.6
func SingularIndexDataSeq ¶ added in v1.1.6
func SingularKeyValueSeq ¶ added in v1.1.7
func SliceEmpty ¶ added in v1.0.55
func SliceEqual ¶ added in v1.0.11
func SliceEqual[Datas ~[]Data, Data comparable](as Datas, bs Datas) bool
func SliceMappingByKey ¶
func SliceMappingByKey[Data any, Datas ~[]Data, Key comparable](datas Datas, key func(Data) Key) map[Key]Datas
func SliceMappingByKeys ¶
func SliceMappingByKeys[Data any, Datas ~[]Data, Key comparable, Keys ~[]Key](datas Datas, keys func(Data) Keys) map[Key]Datas
func SortByKey ¶ added in v1.0.88
func SortByKey[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key, desc bool) Datas
func SortByKeyAsc ¶ added in v1.0.88
func SortByKeyAsc[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key) Datas
func SortByKeyDesc ¶ added in v1.0.88
func SortByKeyDesc[Datas ~[]Data, Data any, Key constraints.Ordered](datas Datas, key func(Data) Key) Datas
func SortFast ¶
func SortFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas
func SortUniqueFast ¶
func SortUniqueFast[Data constraints.Ordered, Datas ~[]Data](datas Datas) Datas
func StableUniqueBySet ¶ added in v1.0.65
func StableUniqueBySet[Datas ~[]Data, Data comparable](datas Datas) Datas
func SubMapByKeys ¶ added in v1.0.17
func SubMapByKeys[Key comparable, Value any, Map ~map[Key]Value](m Map, keys ...Key) Map
func ToTypeless ¶ added in v1.0.35
func ToTypelessSlice ¶ added in v1.0.35
func TypeAsserter ¶ added in v1.0.61
func UnchainUnaryHandler ¶ added in v1.0.46
func Unique ¶
func Unique[Data comparable, Datas ~[]Data](datas Datas, equal func(Data, Data) bool) Datas
func UniqueByKeySet ¶ added in v1.0.11
func UniqueByKeySet[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Datas
func UniqueBySet ¶
func UniqueBySet[Data comparable, Datas ~[]Data](datas Datas) Datas
func UniqueSorteds ¶ added in v1.0.11
func UniqueSorteds[Data comparable, Datas ~[]Data](datas Datas) Datas
func UnmarshalJson ¶ added in v1.0.77
func WriteSeq2DataError ¶ added in v1.1.8
func WriteSeq2Key ¶ added in v1.1.8
func WriteSeq2Value ¶ added in v1.1.8
Types ¶
type Addend ¶ added in v1.0.19
type Addend interface {
constraints.Integer | constraints.Float
}
type BoundedBuffer ¶ added in v1.0.95
type BoundedBuffer[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewBoundedBuffer ¶ added in v1.0.95
func NewBoundedBuffer[Datas ~[]Data, Data any](size int) *BoundedBuffer[Datas, Data]
func (*BoundedBuffer[Datas, Data]) Datas ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) Datas() Datas
func (*BoundedBuffer[Datas, Data]) IsFull ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) IsFull() bool
func (*BoundedBuffer[Datas, Data]) IsTruncated ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) IsTruncated() bool
func (*BoundedBuffer[Datas, Data]) Reset ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) Reset()
func (*BoundedBuffer[Datas, Data]) TotalWritten ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) TotalWritten() int64
func (*BoundedBuffer[Datas, Data]) Write ¶ added in v1.0.95
func (lb *BoundedBuffer[Datas, Data]) Write(datas Datas) (n int, err error)
type Buffer ¶ added in v1.1.1
type Buffer[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
Buffer 为可变长度切片缓冲,语义对齐标准库 bytes.Buffer,元素类型为 Data,底层切片类型为 Datas(须 ~[]Data)。 零值为空缓冲,可直接使用。
func NewBufferFrom ¶ added in v1.1.1
NewBufferFrom 使用已有切片作为初始内容(取得 buf 所有权,调用后勿再使用传入的 buf)。
func (*Buffer[Datas, Data]) AvailableBuffer ¶ added in v1.1.1
func (b *Buffer[Datas, Data]) AvailableBuffer() Datas
AvailableBuffer 返回 len 为 0、指向 buf 空闲尾部的切片,供追加后立即 Write 使用(与 bytes.Buffer.AvailableBuffer 一致)。
func (*Buffer[Datas, Data]) Datas ¶ added in v1.1.1
func (b *Buffer[Datas, Data]) Datas() Datas
Datas 返回长度等于 Len() 的切片,指向当前未读数据;下一次读写/Reset/Truncate 前有效。
func (*Buffer[Datas, Data]) Next ¶ added in v1.1.1
Next 返回接下来至多 n 个未读元素组成的切片,并推进读指针(与 bytes.Buffer.Next 一致)。
func (*Buffer[Datas, Data]) ReadFrom ¶ added in v1.1.1
ReadFrom 从 r 读到 EOF 并追加到缓冲;返回值 n 为读到的元素个数(与 io.ReaderFrom 一致用 int64)。
func (*Buffer[Datas, Data]) Reset ¶ added in v1.1.1
func (b *Buffer[Datas, Data]) Reset()
Reset 清空缓冲,保留底层数组供后续写入复用。
type CachedDataFetcher ¶ added in v1.0.29
func NewCachedDataFetcher ¶ added in v1.0.29
func NewCachedDataFetcher[Data any](fetcher CachedDataFetcherFetchFunc[Data]) *CachedDataFetcher[Data]
func NewCachedDataFetcherFromAnother ¶ added in v1.0.67
func NewCachedDataFetcherFromAnother[Data any, BasedData any](basedFetcher *CachedDataFetcher[BasedData], newDataFromBased func(BasedData) Data) *CachedDataFetcher[Data]
func NewCachedDataFetcherLite ¶ added in v1.0.29
func NewCachedDataFetcherLite[Data any](fetcher CachedDataFetcherFetchFuncLite[Data]) *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) BuildAccessor ¶ added in v1.0.64
func (fetcher *CachedDataFetcher[Data]) BuildAccessor() *CachedDataFetcherAccessor[Data]
func (*CachedDataFetcher[Data]) Dup ¶ added in v1.0.31
func (fetcher *CachedDataFetcher[Data]) Dup() *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) EnsureExpiresDuration ¶ added in v1.0.34
func (fetcher *CachedDataFetcher[Data]) EnsureExpiresDuration(expiresDuration time.Duration) *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) FetchLite ¶ added in v1.0.37
func (fetcher *CachedDataFetcher[Data]) FetchLite(ctx context.Context) (data Data, err error)
func (*CachedDataFetcher[Data]) FetchWithExpires ¶ added in v1.0.34
func (*CachedDataFetcher[Data]) FetchWithExpiresPro ¶ added in v1.0.64
func (*CachedDataFetcher[Data]) FetchWithSince ¶ added in v1.0.34
func (*CachedDataFetcher[Data]) Get ¶ added in v1.0.29
func (fetcher *CachedDataFetcher[Data]) Get() (Data, time.Time, bool)
func (*CachedDataFetcher[Data]) GetCached ¶ added in v1.0.34
func (fetcher *CachedDataFetcher[Data]) GetCached() (Data, time.Time)
func (*CachedDataFetcher[Data]) GetFetchLite ¶ added in v1.0.44
func (fetcher *CachedDataFetcher[Data]) GetFetchLite() func(ctx context.Context) (Data, error)
func (*CachedDataFetcher[Data]) GetRefresh ¶ added in v1.0.44
func (*CachedDataFetcher[Data]) GetWithExpires ¶ added in v1.0.34
func (*CachedDataFetcher[Data]) GetWithExpiresWarn ¶ added in v1.0.61
func (fetcher *CachedDataFetcher[Data]) GetWithExpiresWarn(expiresDuration time.Duration) (Data, bool)
func (*CachedDataFetcher[Data]) GetWithSince ¶ added in v1.0.34
func (*CachedDataFetcher[Data]) GetWithSinceWarn ¶ added in v1.0.61
func (fetcher *CachedDataFetcher[Data]) GetWithSinceWarn(since time.Time) (data Data, ok bool)
func (*CachedDataFetcher[Data]) NewCallback ¶ added in v1.0.36
func (fetcher *CachedDataFetcher[Data]) NewCallback(callback CachedDataFetcherCallbackFunc[Data], timeout time.Duration) *CachedDataFetcherCallback[Data]
func (*CachedDataFetcher[Data]) NewCallbackLite ¶ added in v1.0.36
func (fetcher *CachedDataFetcher[Data]) NewCallbackLite(callback func(context.Context), timeout time.Duration) *CachedDataFetcherCallback[Data]
func (*CachedDataFetcher[Data]) PurgeCachedData ¶ added in v1.0.44
func (fetcher *CachedDataFetcher[Data]) PurgeCachedData()
func (*CachedDataFetcher[Data]) RefreshLowerCache ¶ added in v1.0.69
func (*CachedDataFetcher[Data]) RefreshWithSinceTime ¶ added in v1.0.69
func (*CachedDataFetcher[Data]) RegisterCallback ¶ added in v1.0.36
func (fetcher *CachedDataFetcher[Data]) RegisterCallback(callback *CachedDataFetcherCallback[Data]) *CachedDataFetcherCallback[Data]
func (*CachedDataFetcher[Data]) RegisterCallbackFunc ¶ added in v1.0.69
func (fetcher *CachedDataFetcher[Data]) RegisterCallbackFunc(callback CachedDataFetcherCallbackFunc[Data], timeout time.Duration)
func (*CachedDataFetcher[Data]) RegisterCallbackFuncLite ¶ added in v1.0.37
func (fetcher *CachedDataFetcher[Data]) RegisterCallbackFuncLite(callback func(context.Context), timeout time.Duration)
func (*CachedDataFetcher[Data]) SinceTimeFromExpiresDuration ¶ added in v1.0.39
func (fetcher *CachedDataFetcher[Data]) SinceTimeFromExpiresDuration(expiresDuration time.Duration) (since time.Time)
func (*CachedDataFetcher[Data]) TriggerRefreshLowerCache ¶ added in v1.0.69
func (fetcher *CachedDataFetcher[Data]) TriggerRefreshLowerCache(ctx context.Context)
func (*CachedDataFetcher[Data]) WithCachedDataPurged ¶ added in v1.0.44
func (fetcher *CachedDataFetcher[Data]) WithCachedDataPurged() *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) WithExpiresDuration ¶ added in v1.0.30
func (fetcher *CachedDataFetcher[Data]) WithExpiresDuration(duration time.Duration) *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) WithFetcher ¶ added in v1.0.30
func (fetcher *CachedDataFetcher[Data]) WithFetcher(fetcherFunc CachedDataFetcherFetchFunc[Data]) *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) WithLogger ¶ added in v1.0.57
func (fetcher *CachedDataFetcher[Data]) WithLogger(logger *zap.Logger) *CachedDataFetcher[Data]
func (*CachedDataFetcher[Data]) WithOthersSubscribed ¶ added in v1.0.38
func (fetcher *CachedDataFetcher[Data]) WithOthersSubscribed(timeout time.Duration, others ...interface { RegisterCallbackFuncLite(func(context.Context), time.Duration) }) *CachedDataFetcher[Data]
type CachedDataFetcherAccessor ¶ added in v1.0.64
type CachedDataFetcherAccessor[Data any] struct { // contains filtered or unexported fields }
func (*CachedDataFetcherAccessor[Data]) Dup ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) Dup() *CachedDataFetcherAccessor[Data]
func (*CachedDataFetcherAccessor[Data]) Get ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) Get() (data Data, ok bool)
func (*CachedDataFetcherAccessor[Data]) GetLogger ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) GetLogger() *zap.Logger
func (*CachedDataFetcherAccessor[Data]) WithExpiresDuration ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) WithExpiresDuration(expiresDuration time.Duration) *CachedDataFetcherAccessor[Data]
func (*CachedDataFetcherAccessor[Data]) WithFallbackDuration ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) WithFallbackDuration(fallbackDuration time.Duration) *CachedDataFetcherAccessor[Data]
func (*CachedDataFetcherAccessor[Data]) WithLogExpired ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) WithLogExpired(logExpired bool) *CachedDataFetcherAccessor[Data]
func (*CachedDataFetcherAccessor[Data]) WithLogger ¶ added in v1.0.64
func (getter *CachedDataFetcherAccessor[Data]) WithLogger(logger *zap.Logger) *CachedDataFetcherAccessor[Data]
type CachedDataFetcherCallback ¶ added in v1.0.36
type CachedDataFetcherCallback[Data any] struct { // contains filtered or unexported fields }
func NewCachedDataFetcherCallback ¶ added in v1.0.36
func (*CachedDataFetcherCallback[Data]) Call ¶ added in v1.0.36
func (callback *CachedDataFetcherCallback[Data]) Call(data Data, lastFetchTime time.Time)
type CachedDataFetcherCallbackFunc ¶ added in v1.0.36
type CachedDataFetcherCallbacks ¶ added in v1.0.36
type CachedDataFetcherCallbacks[Data any] []*CachedDataFetcherCallback[Data]
func (CachedDataFetcherCallbacks[Data]) Append ¶ added in v1.0.36
func (callbacks CachedDataFetcherCallbacks[Data]) Append(others ...*CachedDataFetcherCallback[Data]) CachedDataFetcherCallbacks[Data]
func (CachedDataFetcherCallbacks[Data]) Call ¶ added in v1.0.36
func (callbacks CachedDataFetcherCallbacks[Data]) Call(data Data, lastFetchTime time.Time)
type CachedDataFetcherFetchFunc ¶ added in v1.0.38
type CachedDataFetcherFetchFuncLite ¶ added in v1.0.38
type ChanPipe ¶ added in v1.1.1
type ChanPipe[Data any] struct { // contains filtered or unexported fields }
func NewBufferedChanPipe ¶ added in v1.1.1
func NewChanPipe ¶ added in v1.1.1
func (*ChanPipe[Data]) Canceled ¶ added in v1.1.1
func (pipe *ChanPipe[Data]) Canceled() <-chan struct{}
func (*ChanPipe[Data]) IsCanceled ¶ added in v1.1.1
type Closers ¶ added in v1.1.22
func NewClosers ¶ added in v1.1.22
type ComparableSlice ¶ added in v1.0.8
type ComparableSlice[Data comparable] []Data
func NewComparableSlice ¶ added in v1.0.8
func NewComparableSlice[Data comparable](datas ...Data) ComparableSlice[Data]
func (ComparableSlice[Data]) AllMatch ¶ added in v1.0.8
func (slice ComparableSlice[Data]) AllMatch(f func(Data) bool) bool
func (ComparableSlice[Data]) AnyMatch ¶ added in v1.0.8
func (slice ComparableSlice[Data]) AnyMatch(f func(Data) bool) bool
func (ComparableSlice[Data]) Contain ¶ added in v1.0.11
func (slice ComparableSlice[Data]) Contain(data Data) bool
func (ComparableSlice[Data]) ContainAll ¶ added in v1.0.11
func (slice ComparableSlice[Data]) ContainAll(datas ...Data) bool
func (ComparableSlice[Data]) ContainAny ¶ added in v1.0.11
func (slice ComparableSlice[Data]) ContainAny(datas ...Data) bool
func (ComparableSlice[Data]) Dup ¶ added in v1.0.8
func (slice ComparableSlice[Data]) Dup() ComparableSlice[Data]
func (ComparableSlice[Data]) Filter ¶ added in v1.0.8
func (slice ComparableSlice[Data]) Filter(f func(Data) bool) ComparableSlice[Data]
func (ComparableSlice[Data]) ForEachPro ¶ added in v1.0.8
func (slice ComparableSlice[Data]) ForEachPro(f func(int, Data, ComparableSlice[Data]))
func (ComparableSlice[Data]) Map ¶ added in v1.0.8
func (slice ComparableSlice[Data]) Map(f func(Data) Data) Slice[Data]
func (ComparableSlice[Data]) Native ¶ added in v1.0.8
func (slice ComparableSlice[Data]) Native() []Data
func (ComparableSlice[Data]) NotNilSlice ¶ added in v1.0.8
func (slice ComparableSlice[Data]) NotNilSlice() ComparableSlice[Data]
type ContextValues ¶ added in v1.0.56
type ContextValues[Key comparable, Value any] map[Key]Value
func NewContextValues ¶ added in v1.0.56
func NewContextValues[Key comparable, Value any]() ContextValues[Key, Value]
func (ContextValues[Key, Value]) ApplyTo ¶ added in v1.0.56
func (values ContextValues[Key, Value]) ApplyTo(ctx context.Context) context.Context
func (ContextValues[Key, Value]) Empty ¶ added in v1.0.56
func (values ContextValues[Key, Value]) Empty() bool
func (ContextValues[Key, Value]) Len ¶ added in v1.0.56
func (values ContextValues[Key, Value]) Len() int
func (ContextValues[Key, Value]) With ¶ added in v1.0.56
func (values ContextValues[Key, Value]) With(key Key, value Value) ContextValues[Key, Value]
type ConvertWriter ¶ added in v1.1.18
type ConvertWriter[Inputs ~[]Input, Outputs ~[]Output, Input any, Output any] struct { NilNopCloseFunc // contains filtered or unexported fields }
func NewConvertWriter ¶ added in v1.1.18
func NewConvertWriter[Inputs ~[]Input, Outputs ~[]Output, Input any, Output any](convert func(input Input) (Output, error), output Writer[Outputs, Output]) *ConvertWriter[Inputs, Outputs, Input, Output]
func (*ConvertWriter[Inputs, Outputs, Input, Output]) Write ¶ added in v1.1.18
func (converter *ConvertWriter[Inputs, Outputs, Input, Output]) Write(datas Inputs) (n int, err error)
type CountWriter ¶ added in v1.1.18
type CountWriter[Datas ~[]Data, Results ~[]Result, Data any, Result constraints.Integer] struct { // contains filtered or unexported fields }
func (*CountWriter[Datas, Results, Data, Result]) Close ¶ added in v1.1.18
func (counter *CountWriter[Datas, Results, Data, Result]) Close() error
func (*CountWriter[Datas, Results, Data, Result]) GetCount ¶ added in v1.1.18
func (counter *CountWriter[Datas, Results, Data, Result]) GetCount() Result
func (*CountWriter[Datas, Results, Data, Result]) Write ¶ added in v1.1.18
func (counter *CountWriter[Datas, Results, Data, Result]) Write(datas Datas) (n int, err error)
type Counter ¶ added in v1.0.60
type Counter[Key comparable] map[Key]int
func Count ¶ added in v1.0.60
func Count[Datas ~[]Data, Data comparable](datas Datas) Counter[Data]
func CountByKey ¶ added in v1.0.53
func CountByKey[Datas ~[]Data, Data any, Key comparable](datas Datas, key func(Data) Key) Counter[Key]
func NewCounter ¶ added in v1.0.60
func NewCounter[Key comparable]() Counter[Key]
func (Counter[Key]) IncreaseValue ¶ added in v1.0.60
type Errors ¶ added in v1.0.26
type Errors []error
func MapWithError ¶ added in v1.0.26
func MapWithErrorPro ¶ added in v1.0.34
func (Errors) FirstError ¶ added in v1.0.26
func (Errors) FirstOneOrZero ¶ added in v1.0.26
type IntOptionMeta ¶ added in v1.1.9
type IntOptionMeta[Data any] struct { Opt func(int) Option[Data] Value string Required bool Default *int }
func NewIntOptionMeta ¶ added in v1.1.9
func NewIntOptionMeta[Data any](opt func(int) Option[Data], value string) IntOptionMeta[Data]
func (IntOptionMeta[Data]) NewOption ¶ added in v1.1.9
func (meta IntOptionMeta[Data]) NewOption() (Option[Data], error)
type IntOptionMetas ¶ added in v1.1.9
type IntOptionMetas[Data any] []IntOptionMeta[Data]
func (IntOptionMetas[Data]) NewOptions ¶ added in v1.1.9
func (metas IntOptionMetas[Data]) NewOptions() (Options[Data], error)
type KeyValuePair ¶ added in v1.0.27
func NewKeyValuePair ¶ added in v1.1.11
func NewKeyValuePair[Key any, Value any](key Key, value Value) *KeyValuePair[Key, Value]
func (*KeyValuePair[Key, Value]) GetKey ¶ added in v1.0.56
func (pair *KeyValuePair[Key, Value]) GetKey() (key Key)
func (*KeyValuePair[Key, Value]) GetKeyValue ¶ added in v1.1.11
func (pair *KeyValuePair[Key, Value]) GetKeyValue() (key Key, value Value)
func (*KeyValuePair[Key, Value]) GetValue ¶ added in v1.1.8
func (pair *KeyValuePair[Key, Value]) GetValue() (value Value)
func (*KeyValuePair[Key, Value]) KeySeq ¶ added in v1.1.11
func (pair *KeyValuePair[Key, Value]) KeySeq() iter.Seq[Key]
func (*KeyValuePair[Key, Value]) KeyValueSeq ¶ added in v1.1.11
func (pair *KeyValuePair[Key, Value]) KeyValueSeq() iter.Seq2[Key, Value]
func (*KeyValuePair[Key, Value]) ValueSeq ¶ added in v1.1.11
func (pair *KeyValuePair[Key, Value]) ValueSeq() iter.Seq[Value]
type KeyValuePairPtrs ¶ added in v1.0.27
type KeyValuePairPtrs[Key any, Value any] []*KeyValuePair[Key, Value]
func MapKeyValuePairPtrs ¶ added in v1.0.27
func MapKeyValuePairPtrs[Map ~map[Key]Value, Key comparable, Value any](m Map) KeyValuePairPtrs[Key, Value]
func (KeyValuePairPtrs[Key, Value]) KeySeq ¶ added in v1.1.8
func (pairs KeyValuePairPtrs[Key, Value]) KeySeq() iter.Seq[Key]
func (KeyValuePairPtrs[Key, Value]) KeyValueSeq ¶ added in v1.1.8
func (pairs KeyValuePairPtrs[Key, Value]) KeyValueSeq() iter.Seq2[Key, Value]
func (KeyValuePairPtrs[Key, Value]) ToTypelessSlice ¶ added in v1.0.35
func (pairs KeyValuePairPtrs[Key, Value]) ToTypelessSlice() []any
func (KeyValuePairPtrs[Key, Value]) ValueSeq ¶ added in v1.1.8
func (pairs KeyValuePairPtrs[Key, Value]) ValueSeq() iter.Seq[Value]
type KeyValuePairs ¶ added in v1.0.27
type KeyValuePairs[Key any, Value any] []KeyValuePair[Key, Value]
func MapKeyValuePairs ¶ added in v1.0.27
func MapKeyValuePairs[Map ~map[Key]Value, Key comparable, Value any](m Map) KeyValuePairs[Key, Value]
func ZipToPairs ¶ added in v1.0.53
func ZipToPairs[Key any, Value any](keys []Key, values []Value) KeyValuePairs[Key, Value]
func (KeyValuePairs[Key, Value]) Append ¶ added in v1.0.56
func (pairs KeyValuePairs[Key, Value]) Append(others ...KeyValuePair[Key, Value]) KeyValuePairs[Key, Value]
func (KeyValuePairs[Key, Value]) KeySeq ¶ added in v1.1.8
func (pairs KeyValuePairs[Key, Value]) KeySeq() iter.Seq[Key]
func (KeyValuePairs[Key, Value]) KeyValueSeq ¶ added in v1.1.8
func (pairs KeyValuePairs[Key, Value]) KeyValueSeq() iter.Seq2[Key, Value]
func (KeyValuePairs[Key, Value]) Sort ¶ added in v1.0.87
func (pairs KeyValuePairs[Key, Value]) Sort(less func(a, b KeyValuePair[Key, Value]) bool) KeyValuePairs[Key, Value]
func (KeyValuePairs[Key, Value]) SortByKey ¶ added in v1.0.87
func (pairs KeyValuePairs[Key, Value]) SortByKey(less func(a, b Key) bool) KeyValuePairs[Key, Value]
func (KeyValuePairs[Key, Value]) SortByValue ¶ added in v1.0.87
func (pairs KeyValuePairs[Key, Value]) SortByValue(less func(a, b Value) bool) KeyValuePairs[Key, Value]
func (KeyValuePairs[Key, Value]) ToTypelessSlice ¶ added in v1.0.35
func (pairs KeyValuePairs[Key, Value]) ToTypelessSlice() []any
func (KeyValuePairs[Key, Value]) ValueSeq ¶ added in v1.1.8
func (pairs KeyValuePairs[Key, Value]) ValueSeq() iter.Seq[Value]
type LimitWriter ¶ added in v1.1.18
type LimitWriter[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewLimitWriter ¶ added in v1.1.18
func NewLimitWriter[Datas ~[]Data, Data any](limit int, writer Writer[Datas, Data]) *LimitWriter[Datas, Data]
func (*LimitWriter[Datas, Data]) Write ¶ added in v1.1.18
func (writer *LimitWriter[Datas, Data]) Write(datas Datas) (int, error)
type MapWriter ¶ added in v1.1.18
type MapWriter[Inputs ~[]Input, Outputs ~[]Output, Input any, Output any] struct { NilNopCloseFunc // contains filtered or unexported fields }
func NewMapWriter ¶ added in v1.1.18
type Mapping ¶ added in v1.0.56
type Mapping[Key comparable, Value any] map[Key]Value
func NewMapping ¶ added in v1.0.56
func NewMapping[Key comparable, Value any]() Mapping[Key, Value]
func NewMappingWithCap ¶ added in v1.1.24
func NewMappingWithCap[Key comparable, Value any](cap int) Mapping[Key, Value]
func (Mapping[Key, Value]) Get ¶ added in v1.1.24
func (m Mapping[Key, Value]) Get(key Key) (_ Value)
func (Mapping[Key, Value]) KeyValuePairs ¶ added in v1.0.87
func (mapping Mapping[Key, Value]) KeyValuePairs() KeyValuePairs[Key, Value]
func (Mapping[Key, Value]) LoadAndDelete ¶ added in v1.1.24
func (Mapping[Key, Value]) LoadOrCreate ¶ added in v1.1.24
func (Mapping[Key, Value]) LoadOrStore ¶ added in v1.1.24
func (Mapping[Key, Value]) Native ¶ added in v1.0.87
func (mapping Mapping[Key, Value]) Native() map[Key]Value
func (Mapping[Key, Value]) Store ¶ added in v1.1.24
func (m Mapping[Key, Value]) Store(key Key, value Value)
type NilNopCloseFunc ¶ added in v1.1.18
type NilNopCloseFunc func() error
func (NilNopCloseFunc) Close ¶ added in v1.1.18
func (close NilNopCloseFunc) Close() error
type NilNopWriteFunc ¶ added in v1.1.18
func (NilNopWriteFunc[Datas, Data]) Write ¶ added in v1.1.18
func (write NilNopWriteFunc[Datas, Data]) Write(datas Datas) (n int, err error)
type NoOpIo ¶ added in v1.1.1
type NoOpIo[Datas ~[]Data, Data any] struct{}
NoOpIo 为空的 IO 操作,用于占位。
type NopWriteCloser ¶ added in v1.1.18
func NewNopWriteCloser ¶ added in v1.1.18
func NewNopWriteCloser[Datas ~[]Data, Data any]() NopWriteCloser[Datas, Data]
type NopWriter ¶ added in v1.1.18
type NopWriter[Datas ~[]Data, Data any] struct{}
func NewNopWriter ¶ added in v1.1.18
type Number ¶ added in v1.1.8
type Number interface {
constraints.Integer | constraints.Float
}
type Numbers ¶ added in v1.1.8
type Numbers[Data Number] []Data
func (Numbers[Data]) AscPercentFor ¶ added in v1.1.8
func (Numbers[Data]) AscPositionFor ¶ added in v1.1.8
func (Numbers[Data]) AscRatioFor ¶ added in v1.1.8
func (Numbers[Data]) DescPercentFor ¶ added in v1.1.8
func (Numbers[Data]) DescPositionFor ¶ added in v1.1.8
func (Numbers[Data]) DescRatioFor ¶ added in v1.1.8
type Options ¶ added in v1.1.1
func NewOptions ¶ added in v1.1.1
func (Options[Data]) ParseAndAppendIntOptions ¶ added in v1.1.9
func (opts Options[Data]) ParseAndAppendIntOptions(metas IntOptionMetas[Data]) (Options[Data], error)
type PeekReader ¶ added in v1.1.1
type PeekReader[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewPeekReader ¶ added in v1.1.1
func NewPeekReader[Datas ~[]Data, Data any](r Reader[Datas, Data]) *PeekReader[Datas, Data]
NewPeekReader 包装 r:未 Peek 时 Read 直接走 r;Peek 后 Read 先消费预读缓冲再读底层。
func (*PeekReader[Datas, Data]) Datas ¶ added in v1.1.1
func (r *PeekReader[Datas, Data]) Datas() Datas
Datas 返回当前预读缓冲中的未读数据;尚未 Peek 时为 nil。
func (*PeekReader[Datas, Data]) Len ¶ added in v1.1.1
func (r *PeekReader[Datas, Data]) Len() int
Len 返回预读缓冲未读长度;尚未 Peek 时为 0。
func (*PeekReader[Datas, Data]) Peek ¶ added in v1.1.1
func (r *PeekReader[Datas, Data]) Peek(n int) (int, error)
Peek 预读 n 个数据,读到新数据时,将原始 Reader 包装为 MultiReader(buffer, original),后续 Read 时先消费预读缓冲再读底层。
func (*PeekReader[Datas, Data]) Read ¶ added in v1.1.1
func (r *PeekReader[Datas, Data]) Read(p []Data) (n int, err error)
读取数据,如果预读缓冲为空,则使用原始 Reader 读取
type PipeParser ¶ added in v1.1.18
type PipeParser[ SrcDatas ~[]SrcData, ResultDatas ~[]ResultData, SrcData any, ResultData any, ] struct { Writer[SrcDatas, SrcData] io.Closer // contains filtered or unexported fields }
func NewPipeParser ¶ added in v1.1.18
func NewPipeParser[ SrcDatas ~[]SrcData, ResultDatas ~[]ResultData, SrcData any, ResultData any, ]( pipe func() (ReadCloser[SrcDatas, SrcData], WriteCloser[SrcDatas, SrcData]), output Writer[ResultDatas, ResultData], readParse func(reader Reader[SrcDatas, SrcData]) (ResultData, error), ) *PipeParser[SrcDatas, ResultDatas, SrcData, ResultData]
func (*PipeParser[SrcDatas, ResultDatas, SrcData, ResultData]) CloseAndJoin ¶ added in v1.1.18
func (parser *PipeParser[SrcDatas, ResultDatas, SrcData, ResultData]) CloseAndJoin()
func (*PipeParser[SrcDatas, ResultDatas, SrcData, ResultData]) Join ¶ added in v1.1.18
func (parser *PipeParser[SrcDatas, ResultDatas, SrcData, ResultData]) Join()
type ProcessWriter ¶ added in v1.1.18
type ProcessWriter[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewPrinter ¶ added in v1.1.18
func NewPrinter[Datas ~[]Data, Data any](fout *os.File) *ProcessWriter[Datas, Data]
func NewProcessWriter ¶ added in v1.1.18
func NewProcessWriter[Datas ~[]Data, Data any](process func(data Data) (err error)) *ProcessWriter[Datas, Data]
func (*ProcessWriter[Datas, Data]) Write ¶ added in v1.1.18
func (processor *ProcessWriter[Datas, Data]) Write(datas Datas) (n int, err error)
type ReadCloser ¶ added in v1.1.18
func NewReadCloser ¶ added in v1.1.23
func NewReadCloser[Datas ~[]Data, Data any](reader Reader[Datas, Data], closer io.Closer) ReadCloser[Datas, Data]
type Reader ¶ added in v1.1.1
func MultiReader ¶ added in v1.1.1
MultiReader 返回按顺序串联多个 Reader 的逻辑 Reader;全部读完后再 Read 返回 io.EOF。 任一子 Reader 返回非 nil 且非 io.EOF 的错误时,该错误会向上返回。
type ReduceWriter ¶ added in v1.1.18
type ReduceWriter[Datas ~[]Data, Results ~[]Result, Data any, Result any] struct { // contains filtered or unexported fields }
func NewReduceWriter ¶ added in v1.1.18
func NewReduceWriter[Datas ~[]Data, Results ~[]Result, Data any, Result any](reduce func(result Result, data Data) Result, output Writer[Results, Result]) *ReduceWriter[Datas, Results, Data, Result]
func (*ReduceWriter[Datas, Results, Data, Result]) Close ¶ added in v1.1.18
func (writer *ReduceWriter[Datas, Results, Data, Result]) Close(datas Datas) (err error)
type ResumeReader ¶ added in v1.1.6
type ResumeReader[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
ResumeReader 出错续读:底层 Read 返回非 nil 且非 io.EOF 时,若底层实现 closer 则先关闭, 再以当前已成功交付给调用方的元素个数为 offset 调用 factory 创建新 Reader,并继续本次 Read(填满 p)。 offset 语义:从逻辑流起点算起,此前各次 Read 已累计返回给调用方的 Data 元素个数。
func NewResumeReader ¶ added in v1.1.6
func NewResumeReader[Datas ~[]Data, Data any](factory func(offset int) (Reader[Datas, Data], error), triesPerRead int) *ResumeReader[Datas, Data]
NewResumeReader 使用 factory 延迟打开底层;factory(offset) 应返回从逻辑流第 offset 个元素起的 Reader。
func (*ResumeReader[Datas, Data]) Read ¶ added in v1.1.6
func (rr *ResumeReader[Datas, Data]) Read(p []Data) (total int, err error)
Read 实现 Reader;底层非 EOF 错误时会关闭并换 reader 后重试,直到成功、EOF 或 factory 失败。
type RingBuffer ¶ added in v1.0.95
type RingBuffer[Datas ~[]Data, Data any] struct { BoundedBuffer[Datas, Data] // contains filtered or unexported fields }
CircularBuffer 循环缓冲区,实现 io.Writer 接口 保留最后 size 字节的数据,新数据会覆盖旧数据 采用动态扩容策略,按写入量逐步增长,避免一次性分配大内存
func NewRingBuffer ¶ added in v1.0.95
func NewRingBuffer[Datas ~[]Data, Data any](size int) *RingBuffer[Datas, Data]
NewRingBuffer 创建新的循环缓冲区 缓冲区采用动态扩容策略,初始为空,随写入量增长
func (*RingBuffer[Datas, Data]) Datas ¶ added in v1.0.95
func (rb *RingBuffer[Datas, Data]) Datas() Datas
Datas 获取缓冲区中的数据(最后写入的字节)
func (*RingBuffer[Datas, Data]) IsTruncated ¶ added in v1.0.95
func (rb *RingBuffer[Datas, Data]) IsTruncated() bool
IsTruncated 返回是否被截断(写入的数据超过缓冲区大小)
func (*RingBuffer[Datas, Data]) Reset ¶ added in v1.0.95
func (rb *RingBuffer[Datas, Data]) Reset()
Reset 重置缓冲区
func (*RingBuffer[Datas, Data]) TotalWritten ¶ added in v1.0.95
func (rb *RingBuffer[Datas, Data]) TotalWritten() int64
TotalWritten 返回总共写入的字节数
func (*RingBuffer[Datas, Data]) Write ¶ added in v1.0.95
func (rb *RingBuffer[Datas, Data]) Write(datas Datas) (n int, err error)
type Set ¶
type Set[Data comparable] map[Data]struct{}
func NewEmptySet ¶
func NewEmptySet[Data comparable]() Set[Data]
func NewSet ¶
func NewSet[Data comparable](datas ...Data) Set[Data]
func (Set[Data]) ContainAll ¶ added in v1.0.49
func (Set[Data]) ContainAny ¶ added in v1.0.49
func (Set[Data]) Difference ¶
func (Set[Data]) FirstAppear ¶ added in v1.0.8
func (set Set[Data]) FirstAppear(datas ...Data) (result Data)
func (Set[Data]) Intersection ¶
func (Set[Data]) SymmetricDifference ¶
type SkipWriter ¶ added in v1.1.18
type SkipWriter[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewSkipWriter ¶ added in v1.1.18
func NewSkipWriter[Datas ~[]Data, Data any](skip int, writer Writer[Datas, Data]) *SkipWriter[Datas, Data]
func (*SkipWriter[Datas, Data]) Write ¶ added in v1.1.18
func (writer *SkipWriter[Datas, Data]) Write(datas Datas) (int, error)
type Slice ¶ added in v1.0.8
type Slice[Data any] []Data
func NewSliceFromSeq ¶ added in v1.1.8
func (Slice[Data]) ForEachPro ¶ added in v1.0.8
func (Slice[Data]) IndexDataSeq ¶ added in v1.1.6
func (Slice[Data]) NotNilSlice ¶ added in v1.0.8
type SyncMap ¶ added in v1.1.9
type SyncMap[Key comparable, Value any] struct { // contains filtered or unexported fields }
func NewSyncMap ¶ added in v1.1.9
func NewSyncMap[Key comparable, Value any]() *SyncMap[Key, Value]
func NewSyncMapPro ¶ added in v1.1.24
func (*SyncMap[Key, Value]) LoadAndDelete ¶ added in v1.1.9
func (*SyncMap[Key, Value]) LoadOrCreate ¶ added in v1.1.9
func (*SyncMap[Key, Value]) LoadOrCreateLite ¶ added in v1.1.9
func (*SyncMap[Key, Value]) LoadOrStore ¶ added in v1.1.9
func (*SyncMap[Key, Value]) Native ¶ added in v1.1.9
func (m *SyncMap[Key, Value]) Native() map[Key]Value
func (*SyncMap[Key, Value]) Store ¶ added in v1.1.9
func (m *SyncMap[Key, Value]) Store(key Key, value Value)
func (*SyncMap[Key, Value]) SwapMapping ¶ added in v1.1.24
type TimedValue ¶ added in v1.0.37
type TimedValue[Value any] struct { // contains filtered or unexported fields }
func NewTimedValue ¶ added in v1.0.37
func NewTimedValue[Value any](value Value, t time.Time) *TimedValue[Value]
func (*TimedValue[Value]) Time ¶ added in v1.0.37
func (timed *TimedValue[Value]) Time() (t time.Time)
func (*TimedValue[Value]) Value ¶ added in v1.0.37
func (timed *TimedValue[Value]) Value() (value Value)
func (*TimedValue[Value]) ValueAndTime ¶ added in v1.0.37
func (timed *TimedValue[Value]) ValueAndTime() (value Value, t time.Time)
type TruncatedBuffer ¶ added in v1.0.95
type TruncatedBuffer[Datas ~[]Data, Data any] struct { BoundedBuffer[Datas, Data] // contains filtered or unexported fields }
func NewTruncatedBuffer ¶ added in v1.0.95
func NewTruncatedBuffer[Datas ~[]Data, Data any](size int) *TruncatedBuffer[Datas, Data]
func (*TruncatedBuffer[Datas, Data]) IsTruncated ¶ added in v1.0.95
func (tb *TruncatedBuffer[Datas, Data]) IsTruncated() bool
func (*TruncatedBuffer[Datas, Data]) Reset ¶ added in v1.0.95
func (tb *TruncatedBuffer[Datas, Data]) Reset()
func (*TruncatedBuffer[Datas, Data]) TotalWritten ¶ added in v1.0.95
func (tb *TruncatedBuffer[Datas, Data]) TotalWritten() int64
func (*TruncatedBuffer[Datas, Data]) Write ¶ added in v1.0.95
func (tb *TruncatedBuffer[Datas, Data]) Write(datas Datas) (int, error)
type UnaryWriteFunc ¶ added in v1.1.18
func NewUnaryWriteFunc ¶ added in v1.1.18
func NewUnaryWriteFunc[Datas ~[]Data, Data any](write func(data Data) (err error)) UnaryWriteFunc[Datas, Data]
func (UnaryWriteFunc[Datas, Data]) Write ¶ added in v1.1.18
func (write UnaryWriteFunc[Datas, Data]) Write(datas Datas) (n int, err error)
type WriteBuffer ¶ added in v1.1.18
type WriteBuffer[Datas ~[]Data, Data any] struct { // contains filtered or unexported fields }
func NewWriteBuffer ¶ added in v1.1.18
func NewWriteBuffer[Datas ~[]Data, Data any]() *WriteBuffer[Datas, Data]
func (*WriteBuffer[Datas, Data]) Datas ¶ added in v1.1.18
func (buffer *WriteBuffer[Datas, Data]) Datas() Datas
func (*WriteBuffer[Datas, Data]) Write ¶ added in v1.1.18
func (buffer *WriteBuffer[Datas, Data]) Write(datas Datas) (n int, err error)
type WriteCloser ¶ added in v1.1.6
func NewNopCloseWriter ¶ added in v1.1.18
func NewNopCloseWriter[Datas ~[]Data, Data any](writer Writer[Datas, Data]) WriteCloser[Datas, Data]
func NewWriteCloser ¶ added in v1.1.18
func NewWriteCloser[Datas ~[]Data, Data any](writer Writer[Datas, Data], closer io.Closer) WriteCloser[Datas, Data]
type WriteClosers ¶ added in v1.1.22
type WriteClosers[Datas ~[]Data, Data any] []WriteCloser[Datas, Data]
func NewWriteClosers ¶ added in v1.1.23
func NewWriteClosers[Datas ~[]Data, Data any](writeClosers ...WriteCloser[Datas, Data]) WriteClosers[Datas, Data]
func (WriteClosers[Datas, Data]) AsClosers ¶ added in v1.1.22
func (writeClosers WriteClosers[Datas, Data]) AsClosers() Closers
func (WriteClosers[Datas, Data]) AsWriters ¶ added in v1.1.22
func (writeClosers WriteClosers[Datas, Data]) AsWriters() Writers[Datas, Data]