concurrency

package
v1.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessItem

func ProcessItem(occurances int, item interface{}, svc IConcurrent) (interface{}, error)

func ProcessItemSliceString

func ProcessItemSliceString(occurances int, item []string, svc *ConcurrentService) []string

ProcessItem process slice of string

Types

type ConcurrentService

type ConcurrentService struct {
}

func (*ConcurrentService) GetServiceStruct

func (svc *ConcurrentService) GetServiceStruct() ConcurrentService

func (*ConcurrentService) ProcessConcurrentlySliceInt

func (svc *ConcurrentService) ProcessConcurrentlySliceInt(item []int, occurances int, myFunc func(i int, end int, wg *sync.WaitGroup, item []int, resultChan chan []int, errChan chan error)) ([]int, []error)

ProcessConcurrentlySliceInt process []int data types concurrently with the predefined function

func (*ConcurrentService) ProcessConcurrentlySliceStr

func (svc *ConcurrentService) ProcessConcurrentlySliceStr(item []string, occurances int, myFunc func(i int, end int, wg *sync.WaitGroup, item []string, resultChan chan []string, errChan chan error)) ([]string, []error)

ProcessConcurrentlySliceStr process []string data types

func (*ConcurrentService) ProcessSomething

func (svc *ConcurrentService) ProcessSomething(data interface{}) (interface{}, int, error)

ProcessSomething process the data to be used by the concurrency call.

It can be overridden by initializing new ConcurrentService Struct

type IConcurrent

type IConcurrent interface {
	ProcessSomething(interface{}) (interface{}, int, error)
	ProcessConcurrentlySliceInt(item []int, occurances int, myFunc func(i int, end int, wg *sync.WaitGroup, item []int, resultChan chan []int, errChan chan error)) ([]int, []error)
	ProcessConcurrentlySliceStr(item []string, occurances int, myFunc func(i int, end int, wg *sync.WaitGroup, item []string, resultChan chan []string, errChan chan error)) ([]string, []error)
	GetServiceStruct() ConcurrentService
}

func NewService

func NewService() IConcurrent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL