action

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExist     = fmt.Errorf("action have exist")
	ErrArgNumber = fmt.Errorf("action arg number invalid")
)

Functions

This section is empty.

Types

type Action

type Action interface {
	// Name func name
	Name() string
	// Arity arg number
	Arity() int
	// ArgType arg type
	ArgType(index int) arg.TypeList
	// IsVariadic is exist variadic
	IsVariadic() bool
	Init(args []arg.Arg) error
	Execute(ceCtx *context.EventContext) error
}

type CommonAction

type CommonAction struct {
	ActionName  string
	FixedArgs   []arg.TypeList
	VariadicArg arg.TypeList
	Fn          function.Function

	Args      []arg.Arg
	ArgTypes  []common.Type
	TargetArg arg.Arg
}

func (*CommonAction) ArgType

func (a *CommonAction) ArgType(index int) arg.TypeList

func (*CommonAction) Arity

func (a *CommonAction) Arity() int

func (*CommonAction) IsVariadic

func (a *CommonAction) IsVariadic() bool

func (*CommonAction) Name

func (a *CommonAction) Name() string

func (*CommonAction) RunArgs

func (a *CommonAction) RunArgs(ceCtx *context.EventContext) ([]interface{}, error)

type FunctionAction

type FunctionAction struct {
	CommonAction
}

func (*FunctionAction) Execute

func (a *FunctionAction) Execute(ceCtx *context.EventContext) error

func (*FunctionAction) Init

func (a *FunctionAction) Init(args []arg.Arg) error

type NestAction

type NestAction interface {
	Action
	InitAction(actions []Action) error
}

type NestActionImpl

type NestActionImpl struct {
	CommonAction
	Actions []Action
}

func (*NestActionImpl) InitAction

func (c *NestActionImpl) InitAction(actions []Action) error

type SourceTargetSameAction

type SourceTargetSameAction struct {
	FunctionAction
}

func (*SourceTargetSameAction) Init

func (a *SourceTargetSameAction) Init(args []arg.Arg) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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