Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lowesyang/go-batcher
Simply create and use batch handler in go
https://github.com/lowesyang/go-batcher
batch batcher go golang
Last synced: 1 day ago
JSON representation
Simply create and use batch handler in go
- Host: GitHub
- URL: https://github.com/lowesyang/go-batcher
- Owner: lowesyang
- License: mit
- Created: 2018-01-26T16:36:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-30T02:07:15.000Z (over 6 years ago)
- Last Synced: 2024-08-08T15:24:32.366Z (3 months ago)
- Topics: batch, batcher, go, golang
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-batcher
Simply create batch handler in go## Install
`go get github.com/yyh1102/go-batcher`## Usage
### Batch
```Go
batch:=NewBatch("TEST", 10, 5*time.Second, func(batch []interface{}) {
// Do your task with batch
})
// Push single data into batch
batch.Push(1)// Push batch of data into batch
arr:=[]interface{}{1,2,3}
batch.Batch(arr)
```#### Batcher (manage batches)
```Go
......
batcher:=NewBatcher()
batcher.AddBatch(batch)
batcher.GetBatch("TEST") // "Batch { name:"TEST", maxCapacity: 10, timeout:5s }"
```