types

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 0 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 interface{}

Action describes an opaque action that is the final result of a match. Implementations would likely need to cast this to a more appropriate type.

type DataInput

type DataInput interface {
	Input(MatchingData) (DataInputResult, error)
}

DataInput describes a type that can extract an input value from the MatchingData.

type DataInputAvailability

type DataInputAvailability int
const (
	// NotAvailable indicates that the data input is not available.
	NotAvailable DataInputAvailability = iota
	// MoreDataMightBeAvailable indicates that there might be more data available.
	MoreDataMightBeAvailable DataInputAvailability = iota
	// AllDataAvailable indicates that all data is present, no more data will be added.
	AllDataAvailable DataInputAvailability = iota
)

type DataInputResult

type DataInputResult struct {
	// Availability describes the kind of data availability the associated data has.
	Availability DataInputAvailability
	// Data is the resulting data. This might be nil if the data is not available or if the
	// backing data is available but the requested value does not.
	Data *string
}

DataInputResult describes the result of evaluating a DataInput.

type Matcher

type Matcher interface {
	Match(MatchingData) (Result, error)
}

Matcher describes a type that can produce a match result from a set of matching data.

type MatchingData

type MatchingData interface{}

MatchingData describes an opaque set of input data.

type OnMatch

type OnMatch struct {
	Matcher Matcher
	Action  Action
}

OnMatch is a node in the match tree, either describing an action (leaf node) or the start of a subtree (internal node).

type Result

type Result struct {
	// MatchResult is the final result, if NeedMoreData is false. This can be nil if the match tree completed
	// but no action was resolved.
	MatchResult *OnMatch
	// NeedMoreData specified whether the match tree failed to resolve due to input data not being available yet.
	// This can imply that as more data is made available, a match might be found.
	NeedMoreData bool
}

Result describes the result of evaluating the match tree.

Jump to

Keyboard shortcuts

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