Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
Interpreter is a script interpreter
func NewInterpreter ¶
func NewInterpreter(script string, logger zerolog.Logger) (*Interpreter, error)
NewInterpreter create new script interpreter
func (*Interpreter) Exec ¶
func (i *Interpreter) Exec(ctx context.Context, input ScriptInput) (OperationStack, error)
Exec a script by the interpreter
type Operation ¶
type Operation struct { Name OperationName Args []string }
Operation object
func NewOperation ¶
func NewOperation(name OperationName, args ...string) *Operation
NewOperation create new operation
func (Operation) GetFirstArg ¶
GetFirstArg retrn first operation argument
type OperationName ¶
type OperationName uint
OperationName is the operation name
const ( // OpDrop to drop an article OpDrop OperationName = iota // OpTriggerWebhook to trigger an outgoing webhook OpTriggerWebhook // OpSendNotification to send a notification to all user devices OpSendNotification // OpSetText to set article text OpSetText // OpSetTitle to set article title OpSetTitle // OpSetCategory to set article category OpSetCategory // OpDisableGlobalNotification to disable global notification OpDisableGlobalNotification )
type OperationStack ¶
type OperationStack []Operation
OperationStack is a stack of operation
func (OperationStack) Contains ¶
func (ops OperationStack) Contains(op OperationName) bool
Contains test if an operation is part of the stack
type ScriptEngine ¶
type ScriptEngine struct {
// contains filtered or unexported fields
}
ScriptEngine is the scripting engine
func NewScriptEngine ¶
func NewScriptEngine(cacheSize int) *ScriptEngine
NewScriptEngine create new script engine
func (*ScriptEngine) Exec ¶
func (s *ScriptEngine) Exec(ctx context.Context, script string, input ScriptInput) (OperationStack, error)
Exec a script by the script engine
Click to show internal directories.
Click to hide internal directories.