{"repo":"dranikpg/gtrs","free":true,"listed":false,"github":"https://github.com/dranikpg/gtrs","clone":"git clone https://github.com/dranikpg/gtrs.git","description":"Turn Redis streams into typed Go channels in just a few lines","language":"Go","stars":92,"topics":["golang","redis","redis-streams"],"license":"Apache-2.0","category":"databases-storage","readme_excerpt":"Go Typed Redis Streams Effectively reading Redis streams requires some work: counting ids, prefetching and buffering, asynchronously sending acknowledgements and parsing entries. What if it was just the following? Wait...it is! 🔥 Quickstart Define a type that represents your stream data. It'll be parsed automatically with all field names converted to snake case. Missing fields will be skipped silently. You can also use the ConvertibleFrom and ConvertibleTo interfaces to do custom parsing. Struct tags can be used to rename fields. Consumers Consumers allow reading redis streams through Go channels. Specify context, a redis client and where to start reading. Make sure to specify StreamConsumerConfig , if you don't like the default ones or want optimal performance. New entries are fetched asynchronously to provide a fast flow 🚂 Don't forget to Close() the consumer. If you want to start reading again where you left off, you can save the last StreamIDs. Group Consumers They work just like regular consumers and allow sending acknowledgements asynchronously. Beware to use Ack only if you keep processing new messages - that is inside a consuming loop or from another goroutine. Even though this introduces a two-sided depdendecy, the consumer is avoids deadlocks. Stopped processing? Check your errors 🔎 Error handling This is where the simplicity fades a litte, but only a little :) The channel provides not just values, but also errors. Those can be only of three types: - ReadError re","default_branch":null,"files":null,"tree":[],"storefront":"/r/dranikpg","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/dranikpg/gtrs/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."}