data

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectOperator

type CollectOperator string
const (
	List  CollectOperator = "List Operator"
	Sum   CollectOperator = "Sum Operator"
	Min   CollectOperator = "Min Operator"
	Max   CollectOperator = "Max Operator"
	Count CollectOperator = "Count Operator" // TODO: Rename to "Number"?
)

type DataType added in v1.0.4

type DataType string
const (
	Boolean  DataType = "boolean"
	Integer  DataType = "integer"
	Long     DataType = "long"
	Float    DataType = "float"
	Double   DataType = "double"
	String   DataType = "string"
	Date     DataType = "date"
	Time     DataType = "time"
	DateTime DataType = "datetime"
)

type DecisionTable added in v1.0.4

type DecisionTable struct {
	ID                 string
	Name               string
	HitPolicy          HitPolicy
	CollectOperator    CollectOperator
	ExpressionLanguage ExpressionLanguage
	Standard           Standard

	InputFields  []FieldInterface
	OutputFields []FieldInterface
	Rules        []Rule

	Interferences bool
}

type EntryInterface

type EntryInterface interface {
	String() string
	ExpressionLanguage() ExpressionLanguage

	Validate() (bool, []error)
	ValidateDataTypeOfExpression(varType DataType) (bool, error)
	ValidateExistenceOfFieldReferencesInExpression(fields []FieldInterface) ([]FieldInterface, []error)

	Convert(listener ast.SFeelListenerInterface)
}

type ExpressionLanguage

type ExpressionLanguage string
const (
	SFEEL ExpressionLanguage = "SFEEL"
	FEEL  ExpressionLanguage = "FEEL"
)

type FieldInterface

type FieldInterface interface {
	ID() string
	DataType() DataType
	String() string
	GetQualifiedName() string
}

type HitPolicy

type HitPolicy string
const (
	Unique   HitPolicy = "Unique"   // Rules do not overlap. Only a single rule can match.
	First    HitPolicy = "First"    // Rules are evaluated from top to bottom. Rules may overlap, but only the first match counts.
	Priority HitPolicy = "Priority" // Rule outputs are prioritized. Rules may overlap, but only the match with the highest output priority counts.
	Any      HitPolicy = "Any"      // Multiple matching rules must not make a difference: all matching rules must lead to the same output.
)

Single result decision tables

const (
	Collect     HitPolicy = "Collect"      // All matching rules result in an arbitrarily ordered list of all the output entries.
	RuleOrder   HitPolicy = "Rule Order"   // All matching rules result in a list of outputs ordered by the sequence of those rules in the decision table.
	OutputOrder HitPolicy = "Output Order" // All matching rules result in a list of outputs ordered by their (decreasing) output priority.
)

Multiple result decision tables

type Rule

type Rule struct {
	Description   string
	InputEntries  []EntryInterface
	OutputEntries []EntryInterface

	InputExpressions  []string
	OutputExpressions []string
}

type Standard added in v1.0.4

type Standard string
const (
	GRULE  Standard = "GRULE"
	DMN    Standard = "DMN (OMG)"
	DROOLS Standard = "DROOLS (REDHAT)"
)

type TestField

type TestField struct {
	Name string
	Key  string
	Type DataType
}

func (TestField) DataType added in v1.0.4

func (f TestField) DataType() DataType

func (TestField) GetQualifiedName

func (f TestField) GetQualifiedName() string

func (TestField) ID added in v1.0.4

func (f TestField) ID() string

func (TestField) String

func (f TestField) String() string

Jump to

Keyboard shortcuts

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