samber/lo 库的使用方法: 目录

本文介绍了Go语言库samber/lo,它通过泛型提供了一系列高效的操作函数,包括Filter、Map、Reduce等,旨在帮助开发者更方便地处理数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

samber/lo 库的使用方法: 目录

samber/lo 是一个 Go 语言库,使用泛型实现了一些常用的操作函数,如 Filter、Map 和 FilterMap。
这个库函数太多,因此我决定按照功能分别介绍。本文是目录, 便于查找。

  1. slices

    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

  2. maps

    Keys, ValueOr, Values, PickBy, PickByKeys, PickByValues, OmitBy, OmitByKeys, OmitByValues, Entries, ToPairs, FromEntries, FromPairs, Invert, Assign, MapKeys, MapValues, MapEntries, MapToSlice

  3. math

    Range, RangeFrom, RangeWithSteps, Clamp, Sum, Sumby

  4. strings

    RandomString, Substring, ChunkString, RuneLength

  5. tuples

    T2 -> T9, Unpack2 -> Unpack9, Zip2 -> Zip9, Unzip2 -> Unzip9

  6. channels

    ChannelDispatcher, SliceToChannel, Generator, Buffer, BufferWithTimeout, FanIn, FanOut

  7. intersections

    Contains, ContainsBy, Every, EveryBy, Some, SomeBy, None, NoneBy, Intersect, Difference, Union, Without, WithoutEmpty

  8. search

    IndexOf, LastIndexOf, Find, FindIndexOf, FindLastIndexOf, FindOrElse, FindKey, FindKeyBy, FindUniques, FindUniquesBy, FindDuplicates, FindDuplicatesBy, Min, MinBy, Max, MaxBy, Last, Nth, Sample, Samples

  9. condition

    Ternary, TernaryF; If, ElseIf, Else; Switch, Case, Default

  10. type

    IsNil, ToPtr, EmptyableToPtr, FromPtr, FromPtrOr, ToSlicePtr, ToAnySlice, FromAnySlice, Empty, IsEmpty, IsNotEmpty, Coalesce

  11. function
    Partial, Partial2 -> Partial5

  12. Concurrency

    Attempt, AttemptWhile, AttemptWithDelay, AttemptWhileWithDelay, Debounce, DebounceBy, Synchronize, Async, Transaction

  13. Error

    Validate, Must, Try, Try1 -> Try6, TryOr, TryOr1 -> TryOr6, TryCatch, TryWithErrorValue, TryCatchWithErrorValue, ErrorsAs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值