actions

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action map[string][]any

{ "cmd": [ "arg0", "arg1" ] } Action is a command to be executed by the simulator.

type ActionContext

type ActionContext struct {
	InterfaceId string
	Data        map[string]any
}

func (*ActionContext) Get

func (c *ActionContext) Get(key string) any

func (*ActionContext) Set

func (c *ActionContext) Set(key string, value any)

type Context

type Context map[string]any

type Engine

type Engine struct {
	Handlers map[string]HandlerFunc
}

func (*Engine) Call

func (e *Engine) Call(action Action, ctx Context) error

func (*Engine) RegisterHandler

func (e *Engine) RegisterHandler(name string, handler HandlerFunc)

func (*Engine) SetActionHandler

func (e *Engine) SetActionHandler(a Action, ctx Context)

type HandlerFunc

type HandlerFunc func(Action, Context) error

Jump to

Keyboard shortcuts

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