Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.1 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.1 KB

Bucket

example workflow Coverage Status Go Report Card Go Reference License

bucket queues your items and sends them to your callback function in chunks.

Installation

go get github.com/mdaliyan/bucket

Usage

callback := func(items []interface{}) {
    fmt.Println(items)
}

b, _ := bucket.New(bucket.BySize(10), callback)

for i := 0; i < 25; i++ {
    b.Push(i)
}

time.Sleep(time.Microsecond * 100)

fmt.Println(b.Len())

this Prints

[0 1 2 3 4 5 6 7 8 9]
[10 11 12 13 14 15 16 17 18 19]
5