How it works...
RxGo works by abstracting a source stream, which can be an array or a channel, allowing you to aggregate streams, and finally creating observers that handle events. These can handle errors or data. RxGo uses an interface{} type for its argument so that you can pass in arbitrary values. As a result, you must use reflection in order to convert incoming data to its correct type. This can be tricky if you need to return errors on your observers. In addition, the added reflection can be costly in terms of performance.
Lastly, you must modify some shared state, either global or within a local closure, which will be used at the end. In our case, we have a Results type, which is a map with a key of the year and the value of the aggregate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access