{"id":28426704,"url":"https://github.com/keep94/gofunctional2","last_synced_at":"2025-07-02T19:33:46.960Z","repository":{"id":4913761,"uuid":"6070073","full_name":"keep94/gofunctional2","owner":"keep94","description":"Version 2 of gofunctional.","archived":false,"fork":false,"pushed_at":"2013-08-23T04:29:12.000Z","size":148,"stargazers_count":16,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-05T11:11:36.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"benlangfeld/freeswitch-cookbook","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keep94.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}},"created_at":"2012-10-04T03:06:36.000Z","updated_at":"2017-05-16T17:26:05.000Z","dependencies_parsed_at":"2022-08-28T17:52:40.744Z","dependency_job_id":null,"html_url":"https://github.com/keep94/gofunctional2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/keep94/gofunctional2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keep94%2Fgofunctional2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keep94%2Fgofunctional2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keep94%2Fgofunctional2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keep94%2Fgofunctional2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keep94","download_url":"https://codeload.github.com/keep94/gofunctional2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keep94%2Fgofunctional2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261685237,"owners_count":23194074,"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":[],"created_at":"2025-06-05T11:10:50.697Z","updated_at":"2025-06-24T13:30:39.674Z","avatar_url":"https://github.com/keep94.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gofunctional2\n\nThis API is now deprecated in favor of [gofunctional3](https://github.com/keep94/gofunctional3).\n\nFunctional programming in go. The main data type, Stream, is similar to\na python iterator or generator. The methods found in here are similar to\nthe methods found in the python itertools module. This is version 2 of\ngofunctional.\n\nThis API is now stable. Any future changes will be backward compatible with\nexisting code. However, any future function or data structure in \"draft\"\nmode may change in incompatible ways. Such function or data structure will\nbe clearly marked as \"draft\" in the documentation.\n\n## Using\n\n\timport \"github.com/keep94/gofunctional2/functional\"\n\timport \"github.com/keep94/gofunctional2/consume\"\n\n## Installing\n\n\tgo get github.com/keep94/gofunctional2/functional\n\tgo get github.com/keep94/gofunctional2/consume\n\n## Online Documentation\n\nOnline documentation is available [here](http://go.pkgdoc.org/github.com/keep94/gofunctional2).\n\n## Real World Example\n\nSuppose there are names and phone numbers of people stored in a sqlite\ndatabase. The table has a name and phone_number column.\n\nThe person class would look like:\n\n\ttype Person struct {\n\t  Name string\n\t  Phone string\n\t}\n\n\tfunc (p *Person) Ptrs() {\n\t  return []interface{}{\u0026p.Name, \u0026p.Phone}\n\t}\n\nTo get the 4th page of 25 people do:\n\n\tpackage main\n\n\timport (\n\t  \"code.google.com/p/gosqlite/sqlite\"\n\t  \"github.com/keep94/gofunctional2/functional\"\n\t)\n\n\tfunc main() {\n\t  conn, _ := sqlite.Open(\"YourDataFilePath\")\n\t  stmt, _ := conn.Prepare(\"select * from People\")\n\t  s := functional.ReadRows(stmt)\n\t  s = functional.Slice(s, 3 * 25, 4 * 25)\n          var person Person\n          err := s.Next(\u0026person)\n          for ; err == nil; err = s.Next(\u0026person) {\n            // Display person here\n          }\n          if err != functional.Done {\n            // Do error handling here\n\n            s.Close()\n          }\n        }\n\nLike python iterators and generators, Stream types are lazily evaluated, so\nthe above code will read only the first 100 names no matter how many people\nare in the database.\n\nSee tests and the included example for detailed usage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeep94%2Fgofunctional2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeep94%2Fgofunctional2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeep94%2Fgofunctional2/lists"}