Skip to content

mdaliyan/bucket

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Languages