pkg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadDataFromFile

func ReadDataFromFile(inputFile string, creator Creator) ([]interface{}, error)

func Start

func Start(creator Creator, inputs []interface{}, semaphoreSize int, logFileName string)

Creator is an interface that needs to be implemented by the user of the library

import "github.com/vbauerster/mpb/v8" <- progress bar library

type Creator interface {
	CreateFromInput(input interface{}, bar *mpb.Bar, progress chan<- int, cancel <-chan struct{}, statusChan chan<- Status, status *Status)
	ConvertToInput(data []string) interface{}
}

Inputs is any csv file that can be converted to a slice of strings SemaphoreSize is the number of goroutines/csv lines that can run in parallel LogFileName is the name of the log file

Types

type Creator

type Creator interface {
	CreateFromInput(input interface{}, bar *mpb.Bar, progress chan<- int, cancel <-chan struct{}, statusChan chan<- Status, status *Status)
	ConvertToInput(data []string) interface{}
}

type Current added in v1.0.0

type Current string
const (
	Starting  Current = "starting"
	Working   Current = "working"
	Error     Current = "error"
	Retrying  Current = "retrying"
	Completed Current = "completed"
	Failed    Current = "failed"
)

type Status added in v1.0.0

type Status struct {
	Current Current
}

func (*Status) Set added in v1.0.0

func (s *Status) Set(status Current)

Jump to

Keyboard shortcuts

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