{"id":17882189,"url":"https://github.com/mackee/iterutils","last_synced_at":"2026-02-14T03:02:52.355Z","repository":{"id":255438760,"uuid":"850544084","full_name":"mackee/iterutils","owner":"mackee","description":"iterutils is a Go library that provides utilities for working with iterators","archived":false,"fork":false,"pushed_at":"2024-12-16T08:11:44.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T01:49:36.691Z","etag":null,"topics":["asynchronous","go","golang","iterator"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mackee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-01T04:42:00.000Z","updated_at":"2024-12-16T08:11:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"073e7e0c-23b8-4d73-8ea2-6a8782d611ad","html_url":"https://github.com/mackee/iterutils","commit_stats":null,"previous_names":["mackee/iterutils"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mackee/iterutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2Fiterutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2Fiterutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2Fiterutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2Fiterutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mackee","download_url":"https://codeload.github.com/mackee/iterutils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mackee%2Fiterutils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29433297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T02:20:56.896Z","status":"ssl_error","status_checked_at":"2026-02-14T02:11:29.478Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asynchronous","go","golang","iterator"],"created_at":"2024-10-28T12:48:34.004Z","updated_at":"2026-02-14T03:02:52.334Z","avatar_url":"https://github.com/mackee.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iterutils\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/mackee/iterutils.svg)](https://pkg.go.dev/github.com/mackee/iterutils)\n\n`iterutils` is a Go library that provides utilities for working with iterators (`iter.Seq` and `iter.Seq2`). It offers various functions to simplify iteration, transform sequences, and handle concurrent operations. This library is designed to enhance the flexibility and performance of your Go applications by providing easy-to-use iterator utilities.\n\n## Installation\n\nTo install `iterutils`, use `go get`:\n\n```sh\ngo get github.com/mackee/iterutils\n```\n\n## Features\n\n- **FromNexter**: Convert traditional iteration objects into `iter.Seq`.\n- **FromNexter2**: Convert traditional iteration objects returning pairs of values into `iter.Seq2`.\n- **FromTryNexter2**: Handle iteration with error handling, converting objects that return both a value and an error into `iter.Seq2`.\n- **NexterWithT**: Wrap existing iteration types to allow their use with functions like `FromNexter`.\n- **TryNexterWithT**: Wrap iteration types that return values and errors, allowing their use with `FromTryNexter2`.\n- **async.Map**: Apply a function to each element of an iterator asynchronously.\n- **async.Map2**: Apply a function to each pair of elements from a sequence asynchronously.\n\n## Usage\n\n### Basic Example\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/mackee/iterutils\"\n    \"github.com/mackee/iterutils/async\"\n)\n\nfunc main() {\n    // MyNexter is an object that implements the Next() method\n    myNexter := \u0026MyNexter{}\n    // MyTransform is a function that transforms the value returned by MyNexter.Next()\n    itr := iterutils.FromNexter(myNexter, myTransform)\n    // myAsyncTransform is a function that takes lots of time to process but can be executed concurrently\n    asyncIter := async.Map(itr, myAsyncTransform)\n\n    for elem := range asyncSeq {\n        fmt.Println(elem)\n    }\n}\n```\n\n### `FromNexter`\n\nConverts a traditional iterator object into an `iter.Seq`. This is useful for wrapping objects like `database/sql.Rows` or `bufio.Scanner` to be used in an `iter.Seq`.\n\n### `FromNexter2`\n\nSimilar to `FromNexter`, but for iterators that return pairs of values, converting them into an `iter.Seq2`.\n\n### `FromTryNexter2`\n\nHandles iterators that return both a value and an error, converting them into an `iter.Seq2`. This is useful for handling operations like reading from a file or a network stream, where each iteration may result in an error.\n\n### `async.Map`\n\nApplies a function asynchronously to each element of an iterator. This is especially useful when dealing with time-consuming operations that can be executed concurrently. The order of the results in the returned `iter.Seq` is maintained.\n\n### `async.Map2`\n\nSimilar to `async.Map`, but applies the function to each pair of elements from an `iter.Seq2`. The order of the pairs in the returned `iter.Seq2` is maintained.\n\n## License\n\nThis library is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Feel free to submit issues or pull requests to improve the library.\n\n## Author\n\nThis library is developed and maintained by [mackee](https://github.com/mackee).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackee%2Fiterutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmackee%2Fiterutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmackee%2Fiterutils/lists"}