Skip to content

WheeskyJack/batchgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

batchgo

batchgo is a Golang library for batch processing data. It provides a simple way to process large amounts of data in batches.

GitHub top language Go Report Card

Features

  1. Asynchronous batch processing
  2. concurrency-safe mechanism to add item to batch
  3. Slicer interface gives more power to user on how to merge/append the data

Go Docs

Documentation at pkg.go.dev

Installation

go get github.com/WheeskyJack/batchgo

Usage

user need to implement the Slicer intface on the batching object for this pkg to work. It has Append, Len Export and OnFailure methods.

Append method is called to merge the item into existing batch.

Len method is called to get the length of current batch.

Export method is called once batch is full and ready for processing.

OnFailure method is called if Export method fails.

see example dir for the working example. It deomonstartes how Add() can be called concurrently for batching.

Contributing

Contributions are welcome! Please feel free to create an issue and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.