common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilConfig          = errors.New("config must not be nil")
	ErrEmptyCamundaURL    = errors.New("camunda base URL must not be empty")
	ErrNilContext         = errors.New("context must not be nil")
	ErrNoClientConfigured = errors.New("client must not be nil")
)

Functions

func BindConfigEnvVars added in v1.2.0

func BindConfigEnvVars(v *viper.Viper, cfgType reflect.Type, prefix string)

func DefaultVal

func DefaultVal[T comparable](val, def T) T

func EnsureLoggerAndClients added in v1.2.0

func EnsureLoggerAndClients(logger *slog.Logger, clients ...interface{}) (*slog.Logger, error)

func KeysFromItems

func KeysFromItems[T any](items *[]T, getKey func(T) int64) []int64

KeysFromItems returns the int64 keys from a response Items field.

func NewIntegerEqFilterPtr added in v1.1.2

func NewIntegerEqFilterPtr(v int32) *camundav88.IntegerFilterProperty

func NewProcessInstanceKeyEqFilterPtr added in v1.1.2

func NewProcessInstanceKeyEqFilterPtr(v string) *camundav88.ProcessInstanceKeyFilterProperty

func NewProcessInstanceStateEqFilterPtr added in v1.1.2

func NewProcessInstanceStateEqFilterPtr(v string) *camundav88.ProcessInstanceStateFilterProperty

func NewStringEqFilterPtr added in v1.1.0

func NewStringEqFilterPtr(v string) *camundav88.StringFilterProperty

func VerboseLog added in v1.2.0

func VerboseLog(ctx context.Context, callCfg *services.CallCfg, log *slog.Logger, msg string, args ...any)

Types

type Result

type Result[T any] struct {
	Index int // original position in the input slice
	Item  T
	Err   error
}

Result holds the outcome for one item.

func RunBulk

func RunBulk[T any](ctx context.Context, items []T, wantedWorkers int, fn WorkFunc[T]) []Result[T]

RunBulk runs fn over items with up to 'parallel' workers. - If parallel <= 0, it defaults to min(8, len(items)). - Results preserve input order (results[i] corresponds to items[i]). - Honors context cancellation; any not-yet-dispatched items are marked with ctx.Err().

type ServiceDeps added in v1.2.0

type ServiceDeps struct {
	Config     *config.Config
	HTTPClient *http.Client
	Logger     *slog.Logger
}

func PrepareServiceDeps added in v1.2.0

func PrepareServiceDeps(cfg *config.Config, httpClient *http.Client, log *slog.Logger) (ServiceDeps, error)

type WorkFunc

type WorkFunc[T any] func(ctx context.Context, item T) error

WorkFunc is the per-item function you want to run.

Jump to

Keyboard shortcuts

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