A type-safe functional Stream processing library for Go, inspired by the Java Streams API.
Go Streams is a library that brings functional, type-safe stream processing to the Go language. It provides a declarative API for manipulating sequences of data, enabling developers to write more expressive and readable data transformation pipelines. The library is directly inspired by the Java Streams API, adapting its concepts to fit Go's type system and idioms.
Go developers working with complex data transformation workflows who want to write more declarative and readable code. It is particularly suited for those familiar with functional programming patterns or the Java Streams API.
Developers choose Go Streams for its type-safe, declarative API that brings functional programming expressiveness to Go, leveraging generics for compile-time safety. Its lazy evaluation allows efficient processing of large or infinite data sequences, and it interoperates with Go's standard `iter` package.
A Go port of the Java Streams API. Type-safe and functional Go Streams processing
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages Go generics to ensure compile-time type safety across all stream operations, preventing runtime errors in data transformations, as highlighted in the README's emphasis on type-safe operations.
Streams are evaluated lazily, enabling efficient processing of large or infinite sequences without pre-loading all data, demonstrated in examples like Generate for random integers.
Offers a comprehensive set of operations including Map, Filter, Sorted, and Reduce, allowing expressive data pipelines that improve code organization and clarity for complex workflows.
Integrates with Go's standard `iter` package, bridging functional streams with native iterator patterns, as mentioned in the README's blog post link for extra interoperability.
Benchmarks show streams are about 6-7 times slower with higher memory allocation than imperative code, making them unsuitable for latency-sensitive tasks, as admitted in the Performance section.
Due to Go generics limitations, operations like Map to different types or Distinct require using package-level functions instead of methods, complicating the API and reducing fluency, as noted in the Limitations section.
Parallel streams are not yet implemented, limiting scalability for CPU-bound transformations compared to other libraries or manual concurrency, listed under Future in the Completion status.