Top 1.6% dependent packages on proxy.golang.org
Top 0.3% dependent repos on proxy.golang.org
Top 5.6% forks on proxy.golang.org
Top 0.9% docker downloads on proxy.golang.org
proxy.golang.org : github.com/ghemawat/stream
Package stream provides filters that can be chained together in a manner similar to Unix pipelines. A simple example that prints all go files under the current directory: stream.Run is passed a list of filters that are chained together (stream.Find, stream.Grep, stream.WriteLines are filters). Each filter takes as input a sequence of strings and produces a sequence of strings. The empty sequence is passed as input to the first filter. The output of one filter is fed as input to the next filter. stream.Run is just one way to execute filters. Others are stream.Contents (returns the output of the last filter as a []string), and stream.ForEach (executes a supplied function for every output item). Filter execution can result in errors. These are returned from stream functions normally. For example, the following call will return a non-nil error. Each filter takes as input a sequence of strings (read from a channel) and produces as output a sequence of strings (written to a channel). The stream package provides a bunch of useful filters. Applications can define their own filters easily. For example, here is a filter that repeats every input n times: The output will be: Note that Repeat returns a FilterFunc, a function type that implements the Filter interface. This is a common implementation pattern: many simple filters can be expressed as a single function of type FilterFunc. FilterFunc is an appropriate type to use for most filters like Repeat above. However for some filters, dynamic customization is appropriate. Such filters provide their own implementation of the Filter interface with extra methods. For example, stream.Sort provides extra methods that can be used to control how items are sorted: The interface of this package is inspired by the http://labix.org/pipe package. Users may wish to consider that package in case it fits their needs better.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/ghemawat/stream
License: Apache-2.0
Latest release: over 7 years ago
First release: over 7 years ago
Namespace: github.com/ghemawat
Dependent packages: 13
Dependent repositories: 715
Stars: 195 on GitHub
Forks: 14 on GitHub
Docker dependents: 8
Docker downloads: 77,660
See more repository details: repos.ecosyste.ms
Last synced: 7 days ago