batch

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OperationConditionURI

func OperationConditionURI(condition OperationCondition) string

Types

type Handler

type Handler interface {
	ItemsToOperation(func(items []string) (operation Operation, err *data.CodeError)) Handler
	OnResult(func(operationInfo string, operation Operation, result *OperationResult)) Handler
	OnError(func(err *data.CodeError)) Handler
	Start()
}

func NewHandler

func NewHandler(info Info) Handler

type Info

type Info struct {
	flow.Info
	export.FileExporterConfig

	Overwrite bool // 是否覆盖

	// 工作数据源
	WorkList      []flow.Work // 工作数据源:列表
	InputFile     string      // 工作数据源:文件
	ItemSeparate  string      // 工作数据源:每行元素按分隔符分的分隔符
	MinItemsCount int         // 工作数据源:每行元素最小数量
	EnableStdin   bool        // 工作数据源:stdin, 当 InputFile 不存在时使用 stdin

	MaxOperationCountPerRequest int
}

func (*Info) Check

func (info *Info) Check() *data.CodeError

type Operation

type Operation interface {
	flow.Work

	ToOperation() (string, *data.CodeError)
}

type OperationCreator

type OperationCreator interface {
	Create(info string) (work Operation, err *data.CodeError)
}

type OperationResult

type OperationResult struct {
	Code     int
	Hash     string `json:"hash"`
	FSize    int64  `json:"fsize"`
	PutTime  int64  `json:"putTime"`
	MimeType string `json:"mimeType"`
	Type     int    `json:"type"`
	Error    string
	Parts    []int64 `json:"parts"`
}

func One

func One(operation Operation) (*OperationResult, *data.CodeError)

func Some

func Some(operations []Operation) ([]*OperationResult, *data.CodeError)

func (*OperationResult) IsSuccess

func (r *OperationResult) IsSuccess() bool

Jump to

Keyboard shortcuts

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