actor

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: GPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(x, y interface{}, operator string) (bool, error)

func New

func New() chik.Handler

New creates a new actor handler

func StringInterfaceToStateQuery

func StringInterfaceToStateQuery(sourceType, targetType reflect.Type, sourceData interface{}) (interface{}, error)

Types

type Action

type Action struct {
	ID      string         `json:"id"`
	Query   []StateQuery   `json:"query"`
	Perform *types.Command `json:"perform"`
}

Action is composed of a list of Queries and a Command to perform in case the AND composition of queries returns true

type MixedQuery

type MixedQuery struct {
	Var1  string
	Op    string
	Const interface{}
}

MixedQuery compares an element of State.Current with a constant only if that element is different from the same in State.Previous

func (*MixedQuery) Execute

func (q *MixedQuery) Execute(state *State) (res QueryResult, err error)

type QueryResult added in v1.4.0

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

type State

type State struct {
	Current  interface{} `json:"current"`
	Previous interface{} `json:"previous"`
}

func (*State) GetField

func (s *State) GetField(slices []string) (interface{}, error)

func (*State) GetFieldDescriptor added in v1.4.0

func (s *State) GetFieldDescriptor(key string) (*fieldDescriptor, error)

type StateQuery

type StateQuery interface {
	Execute(state *State) (QueryResult, error)
}

type StructQuery

type StructQuery struct {
	Var1 string
	Op   string
	Var2 string
}

StructQuery compares two elements of the State oin every state change

func (*StructQuery) Execute

func (q *StructQuery) Execute(state *State) (res QueryResult, err error)

Jump to

Keyboard shortcuts

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