interpolation

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine handles OTel-inspired interpolation for trigger events

func NewEngine

func NewEngine(logger *zap.Logger) *Engine

func (*Engine) Interpolate

func (e *Engine) Interpolate(input string, event *eventing.MdaiEvent) string

Interpolate processes a string and replaces interpolation expressions with actual values Back-compat: only trigger scope via MdaiEvent

func (*Engine) InterpolateMapWithSources

func (e *Engine) InterpolateMapWithSources(in map[string]string, sources ...ValueSource) map[string]string

InterpolateMapWithSources interpolate map with arbitrary sources (e.g., trigger+template)

func (*Engine) InterpolateWithSources

func (e *Engine) InterpolateWithSources(input string, sources ...ValueSource) string

InterpolateWithSources provide any set of sources (each defines its Scope() name)

func (*Engine) InterpolateWithValues

func (e *Engine) InterpolateWithValues(input string, event *eventing.MdaiEvent, templateValues map[string]string) string

InterpolateWithValues trigger + template scopes

type TemplateSource

type TemplateSource struct {
	Values map[string]string
}

TemplateSource reads from a flat map[string]string

func (TemplateSource) Lookup

func (s TemplateSource) Lookup(field string) (string, bool)

func (TemplateSource) Scope

func (s TemplateSource) Scope() string

type TriggerSource

type TriggerSource struct {
	Event *eventing.MdaiEvent
	// contains filtered or unexported fields
}

TriggerSource reads fields from MdaiEvent (incl. payload.* JSON path)

func (*TriggerSource) Lookup

func (s *TriggerSource) Lookup(field string) (string, bool)

func (*TriggerSource) Scope

func (s *TriggerSource) Scope() string

type ValueSource

type ValueSource interface {
	Scope() string
	Lookup(field string) (string, bool)
}

Jump to

Keyboard shortcuts

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