samber/lo 库的使用方法: 目录
samber/lo 是一个 Go 语言库,使用泛型实现了一些常用的操作函数,如 Filter、Map 和 FilterMap。
这个库函数太多,因此我决定按照功能分别介绍。本文是目录, 便于查找。
-
Filter, Map, FilterMap, FlatMap, Reduce, ReduceRight, ForEach, Times, Uniq, UniqBy, GroupBy, Chunk, PartitionBy, Flatten, Interleave, Shuffle, Reverse, Fill, Repeat, RepeatBy, KeyBy, Associate, Drop, DropRight, DropWhile, DropRightWhile, Reject, Count, CountBy, CountValues, CountValuesBy, Subset, Slice, Replace, ReplaceAll, Compact, IsSorted, IsSortedByKey
-
Keys, ValueOr, Values, PickBy, PickByKeys, PickByValues, OmitBy, OmitByKeys, OmitByValues, Entries, ToPairs, FromEntries, FromPairs, Invert, Assign, MapKeys, MapValues, MapEntries, MapToSlice
-
Range, RangeFrom, RangeWithSteps, Clamp, Sum, Sumby
-
RandomString, Substring, ChunkString, RuneLength
-
T2 -> T9, Unpack2 -> Unpack9, Zip2 -> Zip9, Unzip2 -> Unzip9
-
ChannelDispatcher, SliceToChannel, Generator, Buffer, BufferWithTimeout, FanIn, FanOut
-
Contains, ContainsBy, Every, EveryBy, Some, SomeBy, None, NoneBy, Intersect, Difference, Union, Without, WithoutEmpty
-
IndexOf, LastIndexOf, Find, FindIndexOf, FindLastIndexOf, FindOrElse, FindKey, FindKeyBy, FindUniques, FindUniquesBy, FindDuplicates, FindDuplicatesBy, Min, MinBy, Max, MaxBy, Last, Nth, Sample, Samples
-
Ternary, TernaryF; If, ElseIf, Else; Switch, Case, Default
-
IsNil, ToPtr, EmptyableToPtr, FromPtr, FromPtrOr, ToSlicePtr, ToAnySlice, FromAnySlice, Empty, IsEmpty, IsNotEmpty, Coalesce
-
function
Partial, Partial2 -> Partial5 -
Attempt, AttemptWhile, AttemptWithDelay, AttemptWhileWithDelay, Debounce, DebounceBy, Synchronize, Async, Transaction
-
Validate, Must, Try, Try1 -> Try6, TryOr, TryOr1 -> TryOr6, TryCatch, TryWithErrorValue, TryCatchWithErrorValue, ErrorsAs