dopTools

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Coalesce

func Coalesce[T any](v *T, nv T) T

func CompareLists

func CompareLists[T1 any, T2 any](oldList, newList []*T1, getId func(*T1) string, getChanges func(oldItem *T1, newItem *T1) *T2) (deleteList []*T1, updateList []*T2, insertList []*T1)

CompareLists - compares two list and returns lists for: delete, update, insert

func FmtFloat

func FmtFloat(v float64, dec int) string

func NewPtr

func NewPtr[T any](v T) *T

func NewSlicePtr

func NewSlicePtr[T any](v ...T) *[]T

func NormalizePhone

func NormalizePhone(p string) string

func PanicRecover

func PanicRecover(lg logger.WarnAndError, msg string)

func RequirePageSize

func RequirePageSize(pars dopTypes.ListParams, maxPageSize int64) error

func SetViperDefaultsFromObj

func SetViperDefaultsFromObj(obj any)

func SliceExcludeValues

func SliceExcludeValues[T comparable](sl, vs []T) []T

func SliceHasValue

func SliceHasValue[T comparable](sl []T, v T) bool

func SlicesAreSame

func SlicesAreSame[T comparable](a, b []T) bool

func SlicesIntersection

func SlicesIntersection[T comparable](sl1, sl2 []T) []T

func StopSignal

func StopSignal() <-chan os.Signal

func ValidateEmail

func ValidateEmail(v string) bool

func ValidateIin

func ValidateIin(v string) bool

func ValidatePhone

func ValidatePhone(v string) bool

Types

type WorkerPool

type WorkerPool struct {
	// contains filtered or unexported fields
}

func NewWorkerPool

func NewWorkerPool(
	ctx context.Context,
	workerCount int,
	bufferSize int,
) *WorkerPool

func (*WorkerPool) Cancel

func (w *WorkerPool) Cancel(err error)

func (*WorkerPool) Finish

func (w *WorkerPool) Finish()

func (*WorkerPool) FinishAndWait

func (w *WorkerPool) FinishAndWait() error

func (*WorkerPool) GetDuration

func (w *WorkerPool) GetDuration() time.Duration

func (*WorkerPool) Submit

func (w *WorkerPool) Submit(task workerPoolTaskT) bool

func (*WorkerPool) Wait

func (w *WorkerPool) Wait() error

Jump to

Keyboard shortcuts

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