models

package
v0.0.0-...-32eac98 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: LGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RunStatusInProgress is used for when a run is actively being executed.
	RunStatusInProgress = RunStatus("in progress")
	// RunStatusErrored is used for when a run has errored and will not complete.
	RunStatusErrored = RunStatus("errored")
	// RunStatusCompleted is used for when a run has successfully completed execution.
	RunStatusCompleted = RunStatus("completed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type JSON

type JSON struct {
	gjson.Result
}

JSON stores the json types string, number, bool, and null. Arrays and Objects are returned as their raw json types.

func ParseJSON

func ParseJSON(b []byte) (JSON, error)

ParseJSON attempts to coerce the input byte array into valid JSON and parse it into a JSON object.

func (JSON) Add

func (j JSON) Add(key string, val interface{}) (JSON, error)

Add returns a new instance of JSON with the new value added.

func (JSON) Bytes

func (j JSON) Bytes() []byte

Bytes returns the raw JSON.

func (JSON) Empty

func (j JSON) Empty() bool

Empty returns true if the JSON does not exist.

func (JSON) MarshalJSON

func (j JSON) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON data if it already exists, returns an empty JSON object as bytes if not.

func (JSON) Merge

func (j JSON) Merge(j2 JSON) (JSON, error)

Merge combines the given JSON with the existing JSON.

func (*JSON) UnmarshalJSON

func (j *JSON) UnmarshalJSON(b []byte) error

UnmarshalJSON parses the JSON bytes and stores in the *JSON pointer.

type JobRun

type JobRun struct {
	ID        string        `json:"id"`
	JobID     string        `json:"jobId"`
	Scheduler SchedulerSpec `json:"scheduler"`
	Result    RunResult     `json:"result"`
	Status    RunStatus     `json:"status"`
	TaskRuns  []TaskRun     `json:"taskRuns"`
}

func (JobRun) ApplyResult

func (jr JobRun) ApplyResult(result RunResult) JobRun

type JobSpec

type JobSpec struct {
	ID        string        `json:"id"`
	Scheduler SchedulerSpec `json:"scheduler"`
	Tasks     []TaskSpec    `json:"tasks"`
	Request   []byte        `json:"request"`
}

func (JobSpec) NewRun

func (j JobSpec) NewRun() JobRun

type RunResult

type RunResult struct {
	JobRunID     string    `json:"jobRunId"`
	Data         []byte    `json:"data"`
	Status       RunStatus `json:"status"`
	ErrorMessage string    `json:"error"`
}

func (RunResult) WithError

func (rr RunResult) WithError(err error) RunResult

func (RunResult) WithValue

func (rr RunResult) WithValue(data []byte) RunResult

type RunStatus

type RunStatus string

func (RunStatus) Completed

func (s RunStatus) Completed() bool

Completed returns true if the status is RunStatusCompleted.

func (RunStatus) Errored

func (s RunStatus) Errored() bool

Errored returns true if the status is RunStatusErrored.

func (RunStatus) Runnable

func (s RunStatus) Runnable() bool

Runnable returns true if the status is ready to be run.

type SchedulerSpec

type SchedulerSpec struct {
	Type   string `json:"type"`
	Params string `json:"params"`
}

type TaskRun

type TaskRun struct {
	ID     string    `json:"id"`
	Result RunResult `json:"result"`
	Status RunStatus `json:"status"`
	Task   TaskSpec  `json:"task"`
}

func (TaskRun) ApplyResult

func (tr TaskRun) ApplyResult(result RunResult) TaskRun

func (TaskRun) MarkCompleted

func (tr TaskRun) MarkCompleted() TaskRun

type TaskSpec

type TaskSpec struct {
	Type   string `json:"type"`
	Params JSON
}

type WebURL

type WebURL struct {
	*url.URL
}

WebURL contains the URL of the endpoint.

func (*WebURL) MarshalJSON

func (w *WebURL) MarshalJSON() ([]byte, error)

MarshalJSON returns the JSON-encoded string of the given data.

func (*WebURL) String

func (w *WebURL) String() string

String delegates to the wrapped URL struct or an empty string when it is nil

func (*WebURL) UnmarshalJSON

func (w *WebURL) UnmarshalJSON(j []byte) error

UnmarshalJSON parses the raw URL stored in JSON-encoded data to a URL structure and sets it to the URL field.

Jump to

Keyboard shortcuts

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