m3ngyang / gobatcher

A light-weighted golang library for batch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gobatcher

GoDoc Build Status Coverage Status Go Report Card

gobatcher is a light-weighted golang library for batch, which operates the function on the given parameter list concurrently. It fails once any execution returns error.

Install

go get -u github.com/m3ngyang/gobatcher

How to use

Here comes an easy example.

// self-defined function must return error in the result list
func echoString(str string) error {
    fmt.Println(str)
    return nil
}

strs := []string{"Hello", "World", "!"}
goBatcher := New(echoString, strs, 2)
goBatcher.Run()

More examples are in the test file.

About

A light-weighted golang library for batch

License:MIT License


Languages

Language:Go 100.0%