Skip to content

ErezLevip/concurrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent

Concurrent is a simple library for concurrent processing while keeping the original order.

Installation

go get -u "github.com/erezlevip/concurrent"

Quick Start

Create a processing function and call Process with a channel of the objects that needs to be processed, the processing function and the limit per goroutine.

Pass channel:

limitPerGoroutine := 5
processFunc := func(input interface{}) (interface{}, error) { return json.Marshal(input) }
jsonResults, err := concurrent.Process(objectsToProcessChannel, processFunc, limitPerGoroutine)

Pass slice:

limitPerGoroutine := 5
processFunc := func(input interface{}) (interface{}, error) { return json.Marshal(input) }
jsonResults, err := concurrent.ProcessSlice(objectsToProcessSlice, processFunc, limitPerGoroutine)

About

A simple library for concurrent processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages