model

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Catch

type Catch struct {
	ErrorOn             []*ErrorCode `json:"error_on"`
	Next                string       `json:"next"`
	ExcludeErrorMessage []*string    `json:"exclude_error_message"`
}

type Cause

type Cause string
const (
	CauseExecute Cause = "EXECUTE"
	CauseRetry   Cause = "RETRY"
	CauseCatch   Cause = "CATCH"
)

func (Cause) IsValid

func (e Cause) IsValid() bool

func (Cause) MarshalGQL

func (e Cause) MarshalGQL(w io.Writer)

func (Cause) String

func (e Cause) String() string

func (*Cause) UnmarshalGQL

func (e *Cause) UnmarshalGQL(v interface{}) error

type Choice

type Choice struct {
	Not      *ChoiceOperation   `json:"not"`
	Or       []*ChoiceOperation `json:"or"`
	And      []*ChoiceOperation `json:"and"`
	Variable *string            `json:"variable"`
	Helper   *ChoiceHelper      `json:"helper"`
	String   *string            `json:"string"`
	Int      *int               `json:"int"`
	Float    *float64           `json:"float"`
	Next     *string            `json:"next"`
}

type ChoiceHelper

type ChoiceHelper string
const (
	ChoiceHelperStringEquals           ChoiceHelper = "StringEquals"
	ChoiceHelperIntEquals              ChoiceHelper = "IntEquals"
	ChoiceHelperIntGreaterThanEquals   ChoiceHelper = "IntGreaterThanEquals"
	ChoiceHelperIntGreaterThan         ChoiceHelper = "IntGreaterThan"
	ChoiceHelperIntLessThanEquals      ChoiceHelper = "IntLessThanEquals"
	ChoiceHelperIntLessThan            ChoiceHelper = "IntLessThan"
	ChoiceHelperFloatEquals            ChoiceHelper = "FloatEquals"
	ChoiceHelperFloatGreaterThanEquals ChoiceHelper = "FloatGreaterThanEquals"
	ChoiceHelperFloatGreaterThan       ChoiceHelper = "FloatGreaterThan"
	ChoiceHelperFloatLessThanEquals    ChoiceHelper = "FloatLessThanEquals"
	ChoiceHelperFloatLessThan          ChoiceHelper = "FloatLessThan"
)

func (ChoiceHelper) IsValid

func (e ChoiceHelper) IsValid() bool

func (ChoiceHelper) MarshalGQL

func (e ChoiceHelper) MarshalGQL(w io.Writer)

func (ChoiceHelper) String

func (e ChoiceHelper) String() string

func (*ChoiceHelper) UnmarshalGQL

func (e *ChoiceHelper) UnmarshalGQL(v interface{}) error

type ChoiceOperation

type ChoiceOperation struct {
	Variable string       `json:"variable"`
	Helper   ChoiceHelper `json:"helper"`
	String   *string      `json:"string"`
	Int      *int         `json:"int"`
	Float    *float64     `json:"float"`
}

type Endpoint

type Endpoint struct {
	Protocol                Protocol       `json:"protocol"`
	ConnectTimeout          *string        `json:"connect_timeout"`
	DetectedErrorFromHeader []*KVItemInput `json:"detected_error_from_header"`
	// HTTP
	Method   *HTTPMethod    `json:"method"`
	URL      *string        `json:"url"`
	Headers  []*KVItemInput `json:"headers"`
	Body     *string        `json:"body"`
	Insecure *bool          `json:"insecure"`
	Proxy    *string        `json:"proxy"`
	// GRPC
	Symbol *string `json:"symbol"`
	// json or text
	Format      *string  `json:"format"`
	AddHeaders  []string `json:"add_headers"`
	RPCHeaders  []string `json:"rpc_headers"`
	ReflHeaders []string `json:"refl_headers"`
	// PUBSUB
	Credential *string `json:"credential"`
	ProjectID  *string `json:"project_id"`
	TopicID    *string `json:"topic_id"`
	// NATS
	Subject     *string `json:"subject"`
	User        *string `json:"user"`
	Password    *string `json:"password"`
	Token       *string `json:"token"`
	ClusterName *string `json:"cluster_name"`
	// REDIS_STREAM
	Queue *string `json:"queue"`
	Db    *int    `json:"db"`
}

type ErrorCode

type ErrorCode string

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html

const (
	ErrorCodeAll         ErrorCode = "ALL"
	ErrorCodeTimeout     ErrorCode = "TIMEOUT"
	ErrorCodeRuntime     ErrorCode = "RUNTIME"
	ErrorCodeTaskfailed  ErrorCode = "TASKFAILED"
	ErrorCodePermissions ErrorCode = "PERMISSIONS"
)

func (ErrorCode) IsValid

func (e ErrorCode) IsValid() bool

func (ErrorCode) MarshalGQL

func (e ErrorCode) MarshalGQL(w io.Writer)

func (ErrorCode) String

func (e ErrorCode) String() string

func (*ErrorCode) UnmarshalGQL

func (e *ErrorCode) UnmarshalGQL(v interface{}) error

type HTTPMethod

type HTTPMethod string
const (
	HTTPMethodGet    HTTPMethod = "GET"
	HTTPMethodPost   HTTPMethod = "POST"
	HTTPMethodPut    HTTPMethod = "PUT"
	HTTPMethodPatch  HTTPMethod = "PATCH"
	HTTPMethodDelete HTTPMethod = "DELETE"
)

func (HTTPMethod) IsValid

func (e HTTPMethod) IsValid() bool

func (HTTPMethod) MarshalGQL

func (e HTTPMethod) MarshalGQL(w io.Writer)

func (HTTPMethod) String

func (e HTTPMethod) String() string

func (*HTTPMethod) UnmarshalGQL

func (e *HTTPMethod) UnmarshalGQL(v interface{}) error

type Job

type Job struct {
	Comment string `json:"comment"`
	// json string
	Parameters *string `json:"parameters"`
	StartAt    string  `json:"start_at"`
	// How much nums of task will be execute consistently
	ConsistentTaskNums *int    `json:"consistent_task_nums"`
	Tasks              []*Task `json:"tasks"`
	// Maximum seconds of job execution
	Timeout *int `json:"timeout"`
	// Maximum number of task execution
	MaxTaskExecution *int `json:"max_task_execution"`
}

type JobStatus

type JobStatus struct {
	JobID       string         `json:"job_id" gorm:"type: varchar(255)"`
	Status      Status         `json:"status" gorm:"index; type: varchar(64)"`
	Timestamp   time.Time      `json:"timestamp"`
	TaskHistory []*TaskHistory `json:"task_history" gorm:"-"`
}

type KVItemInput

type KVItemInput struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type Protocol

type Protocol string
const (
	ProtocolHTTP        Protocol = "HTTP"
	ProtocolGrpc        Protocol = "GRPC"
	ProtocolPubsub      Protocol = "PUBSUB"
	ProtocolNats        Protocol = "NATS"
	ProtocolRedisStream Protocol = "REDIS_STREAM"
)

func (Protocol) IsValid

func (e Protocol) IsValid() bool

func (Protocol) MarshalGQL

func (e Protocol) MarshalGQL(w io.Writer)

func (Protocol) String

func (e Protocol) String() string

func (*Protocol) UnmarshalGQL

func (e *Protocol) UnmarshalGQL(v interface{}) error

type Retry

type Retry struct {
	ErrorOn []*ErrorCode `json:"error_on"`
	// An integer that represents the number of seconds before the first retry attempt
	Interval *int `json:"interval"`
	// A positive integer that represents the maximum number of retry attempts, Can be replace with variables
	MaxAttempts         *string   `json:"max_attempts"`
	ExcludeErrorMessage []*string `json:"exclude_error_message"`
}

type Status

type Status string
const (
	StatusPending  Status = "PENDING"
	StatusWorking  Status = "WORKING"
	StatusSuccess  Status = "SUCCESS"
	StatusTimeout  Status = "TIMEOUT"
	StatusOverload Status = "OVERLOAD"
	StatusFailed   Status = "FAILED"
)

func (Status) IsValid

func (e Status) IsValid() bool

func (Status) MarshalGQL

func (e Status) MarshalGQL(w io.Writer)

func (Status) String

func (e Status) String() string

func (*Status) UnmarshalGQL

func (e *Status) UnmarshalGQL(v interface{}) error

type Task

type Task struct {
	Name  string   `json:"name"`
	Type  TaskType `json:"type"`
	End   *bool    `json:"end"`
	Next  *string  `json:"next"`
	Retry *Retry   `json:"retry"`
	Catch *Catch   `json:"catch"`
	// Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultpath.html
	InputPath *string `json:"input_path"`
	// Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultpath.html
	ResultPath *string `json:"result_path"`
	// Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-outputpath.html
	OutputPath *string `json:"output_path"`
	ErrorPath  *string `json:"error_path"`
	HeaderPath *string `json:"header_path"`
	// Task
	Endpoint *Endpoint `json:"endpoint"`
	Timeout  *int      `json:"timeout"`
	// Wait
	Seconds *int       `json:"seconds"`
	Until   *time.Time `json:"until"`
	// Parallel
	Branches []*Job `json:"branches"`
	// Choice
	Choices []*Choice `json:"choices"`
	Default *string   `json:"default"`
}

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-states.html

type TaskHistory

type TaskHistory struct {
	From        string     `json:"from" gorm:"type: varchar(255)"`
	Cause       Cause      `json:"cause" gorm:"type: varchar(255)"`
	TaskID      string     `json:"task_id" gorm:"type: varchar(255)"`
	Status      Status     `json:"status" gorm:"type: varchar(64)"`
	RetryCount  *int       `json:"retry_count"`
	ExecutedAt  *time.Time `json:"executed_at"`
	CancelledAt *time.Time `json:"cancelled_at"`
	CompletedAt *time.Time `json:"completed_at"`
	Input       scalar.Map `json:"input" gorm:"type: json"`
	Output      scalar.Map `json:"output" gorm:"type: json"`
}

type TaskType

type TaskType string

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/concepts-states.html

const (
	TaskTypePass     TaskType = "PASS"
	TaskTypeTask     TaskType = "TASK"
	TaskTypeWait     TaskType = "WAIT"
	TaskTypeParallel TaskType = "PARALLEL"
	TaskTypeChoice   TaskType = "CHOICE"
)

func (TaskType) IsValid

func (e TaskType) IsValid() bool

func (TaskType) MarshalGQL

func (e TaskType) MarshalGQL(w io.Writer)

func (TaskType) String

func (e TaskType) String() string

func (*TaskType) UnmarshalGQL

func (e *TaskType) UnmarshalGQL(v interface{}) error

Jump to

Keyboard shortcuts

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