fn: add Collect+CollertErr function for iterators
In this commit, we introduce a new utility function `Collect` to the fn package. This function drains all elements from an iterator and returns them as a slice. This is particularly useful when transitioning from iterator-based APIs to code that expects slices, allowing for gradual migration to the new iterator patterns. The fn module's go.mod is also updated to require Go 1.23, which is necessary for the built-in iter.Seq type support. The replace directive will be removed once the fn package changes are merged and a new version is tagged.
This commit is contained in:
4 files changed
+33
-3
No files matched your search
@@ -206,6 +206,9 @@ require (
|
||||
// store have been included in a tagged sqldb version.
|
||||
replace github.com/lightningnetwork/lnd/sqldb => ./sqldb
|
||||
|
||||
// Replace fn package to use local version with iterator Collect function.
|
||||
replace github.com/lightningnetwork/lnd/fn/v2 => ./fn
|
||||
|
||||
// This replace is for https://github.com/advisories/GHSA-25xm-hr59-7c27
|
||||
replace github.com/ulikunitz/xz => github.com/ulikunitz/xz v0.5.11
|
||||
|
||||
|
||||
Reference in new issue
Block a user