Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itsubaki/gostream
Stream Processing library for Go
https://github.com/itsubaki/gostream
complex-event-processing stream-processing
Last synced: 30 days ago
JSON representation
Stream Processing library for Go
- Host: GitHub
- URL: https://github.com/itsubaki/gostream
- Owner: itsubaki
- License: mit
- Created: 2017-07-03T13:51:59.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2023-09-30T14:08:43.000Z (about 1 year ago)
- Last Synced: 2024-08-03T17:20:29.252Z (4 months ago)
- Topics: complex-event-processing, stream-processing
- Language: Go
- Homepage: https://pkg.go.dev/github.com/itsubaki/gostream
- Size: 234 KB
- Stars: 55
- Watchers: 8
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- go-awesome - gostream
README
# gostream
[![PkgGoDev](https://pkg.go.dev/badge/github.com/itsubaki/gostream)](https://pkg.go.dev/github.com/itsubaki/gostream)
[![Go Report Card](https://goreportcard.com/badge/github.com/itsubaki/gostream?style=flat-square)](https://goreportcard.com/report/github.com/itsubaki/gostream)
[![tests](https://github.com/itsubaki/gostream/workflows/tests/badge.svg?branch=main)](https://github.com/itsubaki/gostream/actions)Stream Processing library for Go
## TODO
- [x] Window
- [x] LengthWindow
- [x] LengthBatchWindow
- [x] TimeWindow
- [x] TimeBatchWindow
- [x] Select
- [ ] Where
- [x] Equals, NotEquals
- [x] Larger, Less
- [ ] AND, OR
- [x] OrderBy
- [x] Limit, Offset
- [x] Aggregate Function
- [x] Avg, Sum, Count
- [x] Max, Min## Example
```go
type LogEvent struct {
Time time.Time
Level int
Message string
}q := "select * from LogEvent.length(10)"
s, err := gostream.New().
Add(LogEvent{}).
Query(q)
if err != nil {
fmt.Printf("new gostream: %v", err)
return
}
defer s.Close()go func() {
for {
fmt.Printf("%v\n", <-s.Output())
}
}()s.Input() <- LogEvent{
Time: time.Now()
Level: 1
Message: "something happened"
}
``````go
type LogEvent struct {
Time time.Time
Level int
Message string
}s := stream.New().
SelectAll().
From(LogEvent{}).
Length(10).
OrderBy("Level", stream.DESC).
Limit(10, 5)
defer s.Close()
go s.Run()go func() {
for {
fmt.Printf("%v\n", <-s.Output())
}
}()s.Input() <- LogEvent{
Time: time.Now()
Level: 1
Message: "something happened"
}
```