reugn / go-streams

A lightweight stream processing library for Go
https://pkg.go.dev/github.com/reugn/go-streams
MIT License
1.92k stars 157 forks source link

How to use `group` or `keyBy` on the stream? #120

Closed stairclimber closed 6 months ago

stairclimber commented 7 months ago

After I read the example coud files in this repo. I cannot find a right way to achieve stream's group function or keyBy function. such as 'partition(stream, key=lambda x: x['country'])' in python streamz or keyBy in flink.

Usage Scene: Count the number of times each country appears in 100 pieces of data.

Maybe I was careless and didn't see the corresponding example. But anyway, I need your help and expect your reply

reugn commented 7 months ago

You're right, stream partitioning is not implemented yet. There are several utility methods available here, but they may not be suitable for your specific requirements.

stairclimber commented 7 months ago

You're right, stream partitioning is not implemented yet. There are several utility methods available here, but they may not be suitable for your specific requirements.

Thanks for your quick reply, your reply saved me a lot of time. I wish your open source career will get better and better