types

package module
v0.0.0-...-7169c5d Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 2 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-types

A utility repository that contains all Golang types that are shared between projects.

Documentation

Index

Constants

View Source
const (
	// Task error codes
	ErrTaskNotFound = stacktrace.ErrorCode(iota)
	ErrInvalidTask

	// Executor error codes
	ErrExecutorFailed

	// Validation error codes
	ErrInvalidInput
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// New creates a new instance of the Executor.
	New() Executor

	// ID returns the unique identifier of the Executor.
	ID() string

	// Name returns the name of the Executor.
	Name() string

	// Description returns the description of the Executor.
	Description() string

	// InputRules returns the input rules for the Executor.
	InputRules() map[string]interface{}

	// OutputRules returns the output rules for the Executor.
	OutputRules() map[string]interface{}

	// Validate validates the task and its dependencies.
	Validate(ctx context.Context, task *Task, tasks []*Task) error

	// Execute executes the task and its dependencies.
	Execute(ctx context.Context, task *Task, tasks []*Task) (interface{}, error)
}

Executor represents an interface for executing tasks.

type Task

type Task struct {
	ID             string           `json:"id" yaml:"id" validate:"required"`
	Name           string           `json:"name" yaml:"name"`
	Description    string           `json:"description" yaml:"description"`
	Executor       string           `json:"executor" yaml:"executor" validate:"required"`
	DependsOn      []string         `json:"dependsOn" yaml:"dependsOn"`
	GlobalInput    interface{}      `json:"globalInput,omitempty" yaml:"globalInput,omitempty"`
	Input          interface{}      `json:"input,omitempty" yaml:"input,omitempty" validate:"required"`
	Output         interface{}      `json:"output,omitempty" yaml:"output,omitempty"`
	Condition      interface{}      `json:"condition,omitempty" yaml:"condition,omitempty"`
	Duration       int64            `json:"duration,omitempty" yaml:"duration,omitempty"`
	LatestDuration int64            `json:"latestDuration,omitempty" yaml:"latestDuration,omitempty"`
	IsExecuting    bool             `yaml:"isExecuting" json:"isExecuting"`
	Succeeded      bool             `yaml:"succeeded" json:"succeeded"`
	NextTaskId     string           `json:"nextTaskId,omitempty" yaml:"nextTaskId,omitempty"`
	Error          error            `json:"error,omitempty" yaml:"error,omitempty"`
	Dependencies   map[string]*Task `json:"-" yaml:"-"`
}

Jump to

Keyboard shortcuts

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