transformer

package
v1.5.0-alpha13 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDGenerator

func IDGenerator(_ context.Context, job *models.Job) error

IDGenerator is a transformer that generates a new ID for the job if it is empty.

Types

type ChainedTransformer added in v1.1.4

type ChainedTransformer[T any] []GenericTransformer[T]

ChainedTransformer is a slice of Transformers that runs in sequence

func (ChainedTransformer[T]) Transform added in v1.1.4

func (ct ChainedTransformer[T]) Transform(ctx context.Context, obj T) error

Transform runs all transformers in sequence.

type GenericTransformer added in v1.1.4

type GenericTransformer[T any] interface {
	Transform(context.Context, T) error
}

GenericTransformer is an interface that can be used to modify an object in place.

type JobFn

type JobFn func(context.Context, *models.Job) error

JobFn is a function that implements JobTransformer transform interface.

func (JobFn) Transform

func (fn JobFn) Transform(ctx context.Context, job *models.Job) error

type JobTransformer added in v1.1.1

type JobTransformer interface {
	GenericTransformer[*models.Job]
}

JobTransformer is an interface that can be used to modify a job in place, such as setting default values or migrating.

func DefaultPublisher added in v1.2.2

func DefaultPublisher(publisherConfig *models.SpecConfig) JobTransformer

func DefaultsApplier added in v1.1.0

func DefaultsApplier(defaults types.JobDefaults) JobTransformer

DefaultsApplier is a transformer that applies default values to the job.

func NameOptional added in v1.1.1

func NameOptional() JobTransformer

NameOptional is a transformer that sets the job name to the job ID if it is empty.

func OrchestratorInstallationID added in v1.5.0

func OrchestratorInstallationID(installationID string) JobTransformer

func OrchestratorInstanceID added in v1.5.0

func OrchestratorInstanceID(instanceID string) JobTransformer

func RequesterInfo added in v1.1.0

func RequesterInfo(requesterNodeID string) JobTransformer

RequesterInfo is a transformer that sets the requester ID in the job meta.

type ResultFn added in v1.1.4

type ResultFn func(context.Context, *models.SpecConfig) error

ResultFn is a function that implements ResultTransformer transform interface.

func (ResultFn) Transform added in v1.1.4

func (fn ResultFn) Transform(ctx context.Context, result *models.SpecConfig) error

type ResultTransformer added in v1.1.4

type ResultTransformer interface {
	GenericTransformer[*models.SpecConfig]
}

ResultTransformer is an interface that can be used to modify a result in place.

Jump to

Keyboard shortcuts

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