GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - samber/ro: 🏎️ Streams & Reactive Programming paradigm for Go: declarative and composable API for event-driven applications

BranchesTags
Open more actions menu

Latest commit

 

History

256 Commits
256 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
bench
bench
 
 
docs
docs
 
 
ee
ee
 
 
examples
examples
 
 
fuzz
fuzz
 
 
internal
internal
 
 
licenses
licenses
 
 
plugins
plugins
 
 
testing
testing
 
 
.gitignore
.gitignore
 
 
.golangci.yml
.golangci.yml
 
 
AGENTS.md
AGENTS.md
 
 
CITATION.cff
CITATION.cff
 
 
CLAUDE.md
CLAUDE.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
errors.go
errors.go
 
 
errors_test.go
errors_test.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
go.work
go.work
 
 
go.work.sum
go.work.sum
 
 
observable.go
observable.go
 
 
observable_test.go
observable_test.go
 
 
observer.go
observer.go
 
 
observer_test.go
observer_test.go
 
 
operator_combining.go
operator_combining.go
 
 
operator_combining_test.go
operator_combining_test.go
 
 
operator_conditional.go
operator_conditional.go
 
 
operator_conditional_test.go
operator_conditional_test.go
 
 
operator_connectable.go
operator_connectable.go
 
 
operator_connectable_test.go
operator_connectable_test.go
 
 
operator_context.go
operator_context.go
 
 
operator_context_test.go
operator_context_test.go
 
 
operator_creation.go
operator_creation.go
 
 
operator_creation_test.go
operator_creation_test.go
 
 
operator_error_handling.go
operator_error_handling.go
 
 
operator_error_handling_test.go
operator_error_handling_test.go
 
 
operator_filter.go
operator_filter.go
 
 
operator_filter_test.go
operator_filter_test.go
 
 
operator_math.go
operator_math.go
 
 
operator_math_test.go
operator_math_test.go
 
 
operator_sink.go
operator_sink.go
 
 
operator_sink_test.go
operator_sink_test.go
 
 
operator_transformations.go
operator_transformations.go
 
 
operator_transformations_test.go
operator_transformations_test.go
 
 
operator_utility.go
operator_utility.go
 
 
operator_utility_test.go
operator_utility_test.go
 
 
pipe.go
pipe.go
 
 
pipe_test.go
pipe_test.go
 
 
ro.go
ro.go
 
 
ro_example_test.go
ro_example_test.go
 
 
ro_test.go
ro_test.go
 
 
scheduler.go
scheduler.go
 
 
subject.go
subject.go
 
 
subject_async.go
subject_async.go
 
 
subject_async_test.go
subject_async_test.go
 
 
subject_behavior.go
subject_behavior.go
 
 
subject_behavior_test.go
subject_behavior_test.go
 
 
subject_publish.go
subject_publish.go
 
 
subject_publish_test.go
subject_publish_test.go
 
 
subject_replay.go
subject_replay.go
 
 
subject_replay_test.go
subject_replay_test.go
 
 
subject_unicast.go
subject_unicast.go
 
 
subject_unicast_test.go
subject_unicast_test.go
 
 
subscriber.go
subscriber.go
 
 
subscriber_test.go
subscriber_test.go
 
 
subscription.go
subscription.go
 
 
subscription_test.go
subscription_test.go
 
 

Repository files navigation

ro - Streams & reactive programming for Go

tag Go Version GoDoc Build Status Go report Coverage Contributors

A Go implementation of the ReactiveX spec.

The purpose of Reactive Programming is to simplify the development of event-driven and asynchronous applications by providing a declarative and composable way to handle streams of data or events.


cover

See also:

  • samber/lo: A Lodash-style Go library based on Go 1.18+ Generics
  • samber/do: A dependency injection toolkit based on Go 1.18+ Generics
  • samber/mo: Monads based on Go 1.18+ Generics (Option, Result, Either...)
  • samber/cc-skills-golang: AI Agent Skills for Golang

What makes it different from samber/lo?

  • lo: synchronous helpers across finite sequences (maps, slices...)
  • ro: processing of infinite data streams for event-driven scenarios

The Reactive Programming paradigm

Reactive Programming is focused on handling asynchronous data streams where values (like user input, API responses, or sensor data) are emitted over time. Instead of pulling data or waiting for events manually, you react to changes as they occur using Observable, Observer, and Operator. This approach simplifies building systems that are responsive, resilient, and scalable, especially in event-driven or real-time applications.

observable := ro.Pipe(
    ro.RangeWithInterval(0, 5, 1*time.Second),
    ro.Filter(func(x int) bool {
        return x%2 == 0
    }),
    ro.Map(func(x int) string {
        return fmt.Sprintf("even-%d", x)
    }),
)

// Start consuming on subscription
observable.Subscribe(ro.NewObserver(
    func(s string) { fmt.Println(s) },
    func(err error) { fmt.Println(err.Error()) },
    func() { fmt.Println("Completed!") }
))
// Output:
//   "even-0"
//   "even-2"
//   "even-4"
//   "Completed!"

// or:

values, err := ro.Collect(observable)
// []string{"even-0", "even-2", "even-4"}
// <nil>

Now you discovered the paradigm, follow the documentation and turn reactive: 🚀 Getting started

🚀 Install

go get github.com/samber/ro

# AI Agent Skill
npx skills add https://github.com/samber/cc-skills-golang --skill golang-samber-ro

This library is v0 and follows SemVer strictly.

Some breaking changes might be made to exported APIs before v1.0.0. Experimental packages under exp/ are considered as unstable.

This library has minimal dependencies outside the Go standard library.

Core package

Full documentation here.

The ro library provides all basic operators:

  • Creation operators: The data source, usually the first argument of ro.Pipe
  • Chainable operators: They filter, validate, transform, enrich... messages
    • Transforming operators: They transform items emitted by an Observable
    • Filtering operators: They selectively emit items from a source Observable
    • Conditional operators: Boolean operators
    • Math and aggregation operators: They perform basic math operations
    • Error handling operators: They help to recover from error notifications from an Observable
    • Combining operators: Combine multiple Observable into one
    • Connectable operators: Convert cold into hot Observable
    • Other: manipulation of context, utility, async scheduling...
  • Plugins: External operators (mostly IOs and library wrappers)

Plugins

The ro library provides a rich ecosystem of plugins for various use cases:

Full documentation here.

Data Manipulation

  • Bytes (plugins/bytes) - String and byte slice manipulation operators
  • Strings (plugins/strings) - String manipulation operators
  • Sort (plugins/sort) - Sorting operators
  • Type Conversion (plugins/strconv) - String conversion operators
  • SIMD (plugins/exp/simd) - SIMD-accelerated transformations

Encoding & Serialization

  • JSON (plugins/encoding/json) - JSON marshaling and unmarshaling
  • CSV (plugins/encoding/csv) - CSV reading and writing
  • Base64 (plugins/encoding/base64) - Base64 encoding and decoding
  • Gob (plugins/encoding/gob) - Go binary serialization

Scheduling & Timing

  • Cron (plugins/cron) - Schedule jobs using cron expressions or duration intervals
  • ICS (plugins/ics) - Read and parse ICS/iCal calendars

Network & I/O

  • HTTP (plugins/http) - HTTP request operators
  • I/O (plugins/io) - File and stream I/O operators
  • File System (plugins/fsnotify) - File system monitoring operators

Observability & Logging

  • Log (plugins/observability/log) - Standard logging operators
  • Zap (plugins/observability/zap) - Structured logging with zap
  • Logrus (plugins/observability/logrus) - Structured logging with logrus
  • Slog (plugins/observability/slog) - Structured logging with slog
  • Zerolog (plugins/observability/zerolog) - Structured logging with zerolog
  • Sentry (plugins/observability/sentry) - Error tracking with Sentry
  • Oops (plugins/samber/oops) - Structured error handling

Rate Limiting

  • Native (plugins/ratelimit/native) - Native rate limiting operators
  • Ulule (plugins/ratelimit/ulule) - Rate limiting with ulule/limiter

Text Processing

  • Regular Expressions (plugins/regexp) - Regular expression operators
  • Templates (plugins/template) - Template processing operators

System Integration

  • Process (plugins/proc) - Process execution operators
  • Signal (plugins/signal) - Signal handling operators
  • Iterators (plugins/iter) - Iterator operators
  • PSI (plugins/samber/psi) - Starvation notifier

Data Validation

  • Validation (plugins/ozzo/ozzo-validation) - Data validation operators

Testing

  • Testing (plugins/testify) - Testing utilities

Utilities

  • HyperLogLog (plugins/hyperloglog) - Cardinality estimation operators
  • Hot (plugins/samber/hot) - In-memory cache

📚 Documentation

  • Documentation - Official doc
  • Godoc - API Reference
  • Plugins - Individual plugin documentation
  • Examples - Working examples

👀 Examples

See the examples directory for complete working examples:

  • Stocker price enrichment - Demonstrate a websocket client with data enrichment
  • Connectable - Demonstrates connectable observables
  • Distributed WebSocket Gateway - Shows how to build a distributed WebSocket gateway
  • Parallel API Requests - Demonstrates concurrent HTTP requests
  • SQL to CSV - Shows how to process database results to CSV
  • ICS to CSV - Shows how to process ICS calendar files to CSV format
  • Enterprise Edition Examples - Examples using enterprise features

🤝 Contributing

Check the contribution guide.

  • Ping me on Twitter @samuelberthe (DMs, mentions, whatever :))
  • Fork the project
  • Fix open issues or request new features

Don't hesitate ;)

👤 Contributors

Contributors

💫 Show your support

Give a ⭐️ if this project helped you!

GitHub Sponsors

License

Copyright © 2025 Samuel Berthe.

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Note: The ee/ directory contains the Enterprise Edition of the library, which is subject to a custom license. Please refer to the ee/LICENSE.md file for the specific terms and conditions applicable to the Enterprise Edition.

About

🏎️ Streams & Reactive Programming paradigm for Go: declarative and composable API for event-driven applications

ro.samber.dev

Topics

event-drivengenericsgogolangobservableobserverpipepipelinereactivereactive-extensionsreactive-programmingreactive-streamsreactivexrxrxjsstreamsubscription

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Security policy

Security policy
Activity

Stars

698 stars

Watchers

1 watching

Forks

27 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.