jobs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidAction invalid action
	ErrInvalidAction = errors.New("invalid action")
)
View Source
var (
	// ErrInvalidRangeExpression invalid range expression
	ErrInvalidRangeExpression = errors.New("invalid range expression")
)
View Source
var (
	// ErrKeyCountInvalid match group count different from context key count
	ErrKeyCountInvalid = errors.New("match group count different from context key count")
)
View Source
var (
	// ErrKeyNotFound key not found error
	ErrKeyNotFound = errors.New("key not found")
)

Functions

This section is empty.

Types

type ConditionContextAction

type ConditionContextAction interface {
	Do(*Context) (bool, error)
}

ConditionContextAction action results condition context

type Config

type Config map[string]interface{}

Config job config

func (Config) Bool

func (c Config) Bool(key string) (bool, error)

Bool get boolean value

func (Config) BoolDefault

func (c Config) BoolDefault(key string, defaultValue bool) bool

BoolDefault get boolean value or default

func (Config) Duration

func (c Config) Duration(key string) (time.Duration, error)

Duration get time duration

func (Config) DurationDefault

func (c Config) DurationDefault(key string, defaultValue time.Duration) time.Duration

DurationDefault get time duration or default

func (Config) Get

func (c Config) Get(key string) (interface{}, error)

Get get raw value

func (Config) Int

func (c Config) Int(key string) (int, error)

Int get int value

func (Config) IntDefault

func (c Config) IntDefault(key string, defaultValue int) int

IntDefault get int value or default

func (Config) Map added in v0.6.1

func (c Config) Map(key string) (map[string]string, error)

Map get map

func (Config) MapDefault added in v0.6.1

func (c Config) MapDefault(key string) map[string]string

MapDefault get map or default

func (Config) String

func (c Config) String(key string) (string, error)

String get string value

func (Config) StringDefault

func (c Config) StringDefault(key, defaultValue string) string

StringDefault get string value or default

func (Config) Strings

func (c Config) Strings(key string) ([]string, error)

Strings get string slice

func (Config) ToJobs

func (c Config) ToJobs() ([]*Job, error)

ToJobs parse config to jobs

type Context

type Context map[string]string

Context job context

func NewContextFromEnv

func NewContextFromEnv(root string) *Context

NewContextFromEnv create context from env

func (Context) Clone

func (c Context) Clone() *Context

Clone clone context

func (Context) Expand

func (c Context) Expand(expression string) string

Expand expand expression by context

func (Context) Int

func (c Context) Int(key string) (int, error)

Int get int value

func (Context) IntDefault

func (c Context) IntDefault(key string, defaultValue int) int

IntDefault get int value or default

func (Context) Set

func (c Context) Set(key, value string)

Set set key value

type Execute

type Execute struct {
	// contains filtered or unexported fields
}

Execute execute external command

func (Execute) Do

func (s Execute) Do(ctx *Context) error

Do do job

type Exists

type Exists struct {
	// contains filtered or unexported fields
}

Exists exists external command

func (Exists) Do

func (s Exists) Do(ctx *Context) (bool, error)

Do do job

type Fetch

type Fetch struct {
	// contains filtered or unexported fields
}

Fetch http get html and match regexp

func (Fetch) Do

func (s Fetch) Do(ctx *Context) ([]*Context, error)

Do do job

type Job

type Job struct {
	Action   interface{}
	Jobs     []*Job
	ElseJobs []*Job
}

Job crawl job

func ReadFile

func ReadFile(filePath string) ([]*Job, error)

ReadFile read jobs from toml file

func (Job) Execute

func (s Job) Execute(ctx *Context) error

Execute execute job

type List added in v0.3.1

type List struct {
	// contains filtered or unexported fields
}

List list files

func (List) Do added in v0.3.1

func (s List) Do(ctx *Context) ([]*Context, error)

Do do job

type ListDir added in v0.6.0

type ListDir struct {
	// contains filtered or unexported fields
}

ListDir list dirs

func (ListDir) Do added in v0.6.0

func (s ListDir) Do(ctx *Context) ([]*Context, error)

Do do job

type Match added in v0.6.0

type Match struct {
	// contains filtered or unexported fields
}

Match http get html and match regexp

func (Match) Do added in v0.6.0

func (s Match) Do(ctx *Context) ([]*Context, error)

Do do job

type MultipleContextAction

type MultipleContextAction interface {
	Do(*Context) ([]*Context, error)
}

MultipleContextAction action results multiple contexts

type OssDownload added in v0.3.1

type OssDownload struct {
	// contains filtered or unexported fields
}

OssDownload ossDownload external command

func (OssDownload) Do added in v0.3.1

func (s OssDownload) Do(ctx *Context) error

Do do job

type OssExists added in v0.3.0

type OssExists struct {
	// contains filtered or unexported fields
}

OssExists ossExists external command

func (OssExists) Do added in v0.3.0

func (s OssExists) Do(ctx *Context) (bool, error)

Do do job

type OssUpload added in v0.3.1

type OssUpload struct {
	// contains filtered or unexported fields
}

OssUpload ossUpload external command

func (OssUpload) Do added in v0.3.1

func (s OssUpload) Do(ctx *Context) error

Do do job

type Range

type Range struct {
	// contains filtered or unexported fields
}

Range for range

func (Range) Do

func (s Range) Do(ctx *Context) ([]*Context, error)

Do do job

type Replace

type Replace struct {
	// contains filtered or unexported fields
}

Replace replace external command

func (Replace) Do

func (s Replace) Do(ctx *Context) error

Do do job

type SingleContextAction

type SingleContextAction interface {
	Do(*Context) error
}

SingleContextAction action results single context

Jump to

Keyboard shortcuts

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