{"id":18849591,"url":"https://github.com/chinalhr/go-stream","last_synced_at":"2026-02-02T22:30:16.481Z","repository":{"id":57703963,"uuid":"492897445","full_name":"ChinaLHR/go-stream","owner":"ChinaLHR","description":"Use Go to implement Java Stream API","archived":false,"fork":false,"pushed_at":"2023-03-09T03:18:15.000Z","size":21,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T14:52:28.393Z","etag":null,"topics":["golang","library","stream","stream-processing"],"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/ChinaLHR.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":"2022-05-16T15:36:35.000Z","updated_at":"2024-06-23T09:26:21.000Z","dependencies_parsed_at":"2024-11-08T03:21:31.650Z","dependency_job_id":"3a2861bd-edd3-4f2d-9223-a9e094ba02b4","html_url":"https://github.com/ChinaLHR/go-stream","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChinaLHR%2Fgo-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChinaLHR%2Fgo-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChinaLHR%2Fgo-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChinaLHR%2Fgo-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChinaLHR","download_url":"https://codeload.github.com/ChinaLHR/go-stream/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786253,"owners_count":19696772,"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","library","stream","stream-processing"],"created_at":"2024-11-08T03:21:11.278Z","updated_at":"2026-02-02T22:30:15.769Z","avatar_url":"https://github.com/ChinaLHR.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## go-stream\n\n[![Language](https://img.shields.io/badge/Language-Go-blue.svg)](https://golang.org/)\n[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/chinalhr/go-stream)](https://img.shields.io/github/go-mod/go-version/chinalhr/go-stream)\n[![Release](https://img.shields.io/github/v/release/chinalhr/go-stream.svg?style=flat-square)](https://github.com/chinalhr/go-stream)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/ChinaLHR/go-stream/build.yaml?branch=main)](https://github.com/ChinaLHR/go-stream/actions/workflows/build.yaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/chinalhr/go-stream)](https://goreportcard.com/report/github.com/chinalhr/go-stream)\n[![codecov](https://codecov.io/gh/chinalhr/go-stream/branch/main/graph/badge.svg?token=ZHMPMQP0CP)](https://codecov.io/gh/chinalhr/go-stream)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/chinalhr/go-stream/blob/main/LICENSE)\n\n## Overview\nGo-Stream is a stream processing library to implement the Java Stream API with Go.\n\n## Features\n- `non-storage`: Stream is not a data structure, but the view of the data source. The data source can come from slice, map or supplier function.\n- `pipeline`: Operate the elements through pipeline, support short-circuit and parallel execution.\n- `lazy-evaluation`: The intermediate operation on the stream is lazy, and it will be truly executed only when the terminal operation is performed.\n\nGo-Stream supports the following operations\n\n| Stream Operation            |                      |                                                              |\n| --------------------------- | -------------------- | ------------------------------------------------------------ |\n| **Intermediate operations** | Stateless            | Filter、Map、Peek、FlatMap                                   |\n|                             | Stateful             | Distinct、Sorted、Skip、Limit、TakeWhile、DropWhile          |\n| **Terminal operations**     | non short-circuiting | ForEach、Reduce、ReduceFromIdentity、Count、Max、Min、FindLast、ToSlice、ToMap、GroupingBy |\n|                             | short-circuiting     | AllMatch、AnyMatch、NoneMatch、FindFirst                     |\n\n## Quick Start\n1. installation go-stream library\n\n```\ngo get github.com/chinalhr/go-stream\n```\n\n2. import\n\n```\nimport \"github.com/chinalhr/go-stream\"\n```\n\n3. Use Stream to process data\n\n```go\n\ttype widget struct {\n\t\tcolor  string\n\t\tweight int\n\t}\n\n\twidgets := []widget{\n\t\t{\n\t\t\tcolor:  \"yellow\",\n\t\t\tweight: 4,\n\t\t},\n\t\t{\n\t\t\tcolor:  \"red\",\n\t\t\tweight: 3,\n\t\t},\n\t\t{\n\t\t\tcolor:  \"yellow\",\n\t\t\tweight: 2,\n\t\t},\n\t\t{\n\t\t\tcolor:  \"blue\",\n\t\t\tweight: 1,\n\t\t},\n\t}\n\n\tsum := stream.OfSlice(widgets).\n\t\tFilter(func(e types.T) bool {\n\t\t\treturn e.(widget).color == \"yellow\"\n\t\t}).\n\t\tMap(func(e types.T) (r types.R) {\n\t\t\treturn e.(widget).weight\n\t\t}).\n\t\tReduce(func(e1 types.T, e2 types.T) types.T {\n\t\t\treturn e1.(int) + e2.(int)\n\t\t})\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinalhr%2Fgo-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchinalhr%2Fgo-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchinalhr%2Fgo-stream/lists"}