{"id":13411503,"url":"https://github.com/yaa110/goterator","last_synced_at":"2025-05-01T13:32:16.655Z","repository":{"id":40312713,"uuid":"287102166","full_name":"yaa110/goterator","owner":"yaa110","description":"Lazy iterator implementation for Golang","archived":false,"fork":false,"pushed_at":"2024-07-08T23:40:16.000Z","size":20,"stargazers_count":16,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-07-31T20:46:04.673Z","etag":null,"topics":["golang","golang-module","golang-package","iterator","mapreduce"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/yaa110/goterator","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/yaa110.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}},"created_at":"2020-08-12T19:47:57.000Z","updated_at":"2024-07-08T23:40:20.000Z","dependencies_parsed_at":"2024-10-26T07:57:24.039Z","dependency_job_id":"7d693c6a-6bec-4ffe-b8a5-d71270f16780","html_url":"https://github.com/yaa110/goterator","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaa110%2Fgoterator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaa110%2Fgoterator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaa110%2Fgoterator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaa110%2Fgoterator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaa110","download_url":"https://codeload.github.com/yaa110/goterator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251881762,"owners_count":21659165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","golang-module","golang-package","iterator","mapreduce"],"created_at":"2024-07-30T20:01:14.126Z","updated_at":"2025-05-01T13:32:16.398Z","avatar_url":"https://github.com/yaa110.png","language":"Go","funding_links":[],"categories":["数据结构与算法","Data Structures","Data Structures and Algorithms","Generators","Data Integration Frameworks","Uncategorized","数据结构`go语言实现的数据结构与算法`","数据结构"],"sub_categories":["迭代器","Advanced Console UIs","Standard CLI","Iterators","标准 CLI"],"readme":"# Goterator\n\n[![Test and Build](https://github.com/yaa110/goterator/workflows/Test%20and%20Build/badge.svg)](https://github.com/yaa110/goterator/actions?query=workflow%3A\"Test+and+Build\") [![PkgGoDev](https://pkg.go.dev/badge/github.com/yaa110/goterator)](https://pkg.go.dev/github.com/yaa110/goterator) [![GoDoc](https://img.shields.io/badge/godoc-goterator-blue)](https://godoc.org/github.com/yaa110/goterator) [![Go Report](https://goreportcard.com/badge/github.com/yaa110/goterator)](https://goreportcard.com/report/github.com/yaa110/goterator) [![Coverage](https://gocover.io/_badge/github.com/yaa110/goterator)](https://gocover.io/github.com/yaa110/goterator)\n\nIterator implementation for Golang to provide map and reduce functionalities.\n\n## Package\n\n```go\nimport (\n    \"github.com/yaa110/goterator\"\n    \"github.com/yaa110/goterator/generator\"\n)\n```\n\n## Getting Started\n\n- Create a generator from slices\n\n```go\nwords := []interface{}{\"an\", \"example\", \"of\", \"goterator\"}\n\ngen := generator.NewSlice(words)\n```\n\n- Create a generator from channels\n\n```go\nchn := make(chan interface{}, 4)\nchn \u003c- \"an\"\nchn \u003c- \"example\"\nchn \u003c- \"of\"\nchn \u003c- \"goterator\"\nclose(chn)\n\ngen := generator.NewChannel(chn)\n```\n\n- Create custom generators\n\n```go\ntype TestGenerator struct {\n    words []string\n    i     int\n    value string\n}\n\nfunc (g *TestGenerator) Next() bool {\n    if g.i == len(g.words) {\n        return false\n    }\n    g.value = g.words[g.i]\n    g.i++\n    return true\n}\n\nfunc (g *TestGenerator) Value() interface{} {\n    return g.value\n}\n\ngen := \u0026TestGenerator{\n    words: []string{\"an\", \"example\", \"of\", \"goterator\"},\n    i: 0,\n    value: \"\",\n}\n```\n\n- Iterate over generators\n\n```go\nlengths := goterator.New(gen).Map(func(word interface{}) interface{} {\n    return len(word.(string))\n}).Collect()\n\nassert.Equal([]interface{}{2, 7, 2, 9}, lengths)\n```\n\nPlease for more information about mappers and reducers (consumers) check the [documentation](https://godoc.org/github.com/yaa110/goterator).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaa110%2Fgoterator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaa110%2Fgoterator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaa110%2Fgoterator/lists"}