pattern

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package pattern provides tools for creating and executing functions with guards. See also: https://github.com/ionous/iffy/wiki/Patterns

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetResultField

func GetResultField(run rt.Runtime, k *rt.Kind) (ret int, err error)

func InitRecord

func InitRecord(run rt.Runtime, k *rt.Kind, keys []string, vals []rt.Value) (ret *rt.Record, err error)

InitRecord fill the passed record with the arguments named by keys and values keys, if any, must match the order of fields in the kind ( but don't need to be contiguous. ) if there are more values than keys, the first values are treated as indexed values; having fewer values than keys is invalid.

Types

type Category

type Category int
const (
	Initializes Category // some sort of record
	Calls                // some sort of callable pattern
	Sends                // some sort of pattern action
	Listens
)

func Categorize

func Categorize(path []string) (ret Category)

meta.KindAncestry

func (Category) String

func (i Category) String() string

type FieldInit

type FieldInit struct {
	Field string
	Init  rt.Assignment
}

type Result

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

func (*Result) GetResult

func (res *Result) GetResult(run rt.Runtime, aff affine.Affinity) (ret rt.Value, err error)

type RuleSet

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

func (*RuleSet) AddRule

func (rs *RuleSet) AddRule(rule rt.Rule)

func (*RuleSet) Calls

func (rs *RuleSet) Calls(run rt.Runtime, rec *rt.Record, resultField int) (res Result, err error)

assumes scope is initialized

func (*RuleSet) Sends

func (rs *RuleSet) Sends(run rt.Runtime, evtObj *rt.Record, chain []string) (okay bool, err error)

trigger a pattern for each of the targets in the passed chain. return false if stopped

Jump to

Keyboard shortcuts

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