actor

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: GPL-3.0 Imports: 9 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 {
	Query   []StateQuery
	Perform *types.Command
}

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 {
	Field    string
	Operator string
	Constant 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) (bool, error)

type State

type State struct {
	Current  interface{}
	Previous interface{}
}

func (*State) GetField

func (s *State) GetField(key string) (interface{}, error)

type StateQuery

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

type StructQuery

type StructQuery struct {
	FirstField  string
	Operator    string
	SecondField string
}

StructQuery compares two elements of the State oin every state change

func (*StructQuery) Execute

func (q *StructQuery) Execute(state *State) (bool, error)

Jump to

Keyboard shortcuts

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