项目作者: mdaliyan

项目描述 :
chunked queue for golang
高级语言: Go
项目地址: git://github.com/mdaliyan/bucket.git
创建时间: 2019-10-17T07:14:09Z
项目社区:https://github.com/mdaliyan/bucket

开源协议:MIT License

下载


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

  1. go get github.com/mdaliyan/bucket

Usage

  1. callback := func(items []interface{}) {
  2. fmt.Println(items)
  3. }
  4. b, _ := bucket.New(bucket.BySize(10), callback)
  5. for i := 0; i < 25; i++ {
  6. b.Push(i)
  7. }
  8. time.Sleep(time.Microsecond * 100)
  9. fmt.Println(b.Len())

this Prints

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