{"repo":"mariomac/gostream","free":true,"listed":false,"github":"https://github.com/mariomac/gostream","clone":"git clone https://github.com/mariomac/gostream.git","description":"A Go port of the Java Streams API. Type-safe and functional Go Streams processing","language":"Go","stars":172,"topics":["golang","go","stream-processing","generics","type-parameters"],"license":"Apache-2.0","category":"data-pipelines","readme_excerpt":"Go Streams API Type safe Stream processing library inspired in the Java Streams API. Table of contents Requirements Usage examples Limitations Performance Completion status Extra credits Requirements Go 1.24 or higher Usage examples For more details about the API, and until pkg.go.dev, is able to parse documentation for functions and types using generics, you can have a quick look to the generated go doc text descriptions, or just let that the embedded document browser of your IDE does the job. Example 1: basic creation, transformation and iteration 1. Creates a literal stream containing all the integers from 1 to 11. 2. From the Stream, selects all the integers that are prime 3. Iterates the stream. For each filtered int, prints a message. Output: Alternatively, you can use the ForEach method to iterate the stream in a functional way: Example 2: generation, map, limit and slice conversion 1. Creates an infinite stream of random integers (no problem, streams are evaluated lazily!) 2. Divides the random integer to get a number between 1 and 6 3. Limits the infinite stream to 5 elements. 4. Collects the stream items as a slice. Output: Example 3: Generation from an iterator, Map to a different type 1. Generates an infinite stream composed by 1 , double(1) , double(double(1)) , etc... and cut it to 6 elements. 2. Maps the numbers' stream to a strings' stream. Because, at the moment, go does not allow type parameters in methods, we need to invoke the stream.Map function instead o","default_branch":null,"files":null,"tree":[],"storefront":"/r/mariomac","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mariomac/gostream/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}