diff --git a/pkg/ottl/expression.go b/pkg/ottl/expression.go index f1adaa161e8d..6f6cc18b81c7 100644 --- a/pkg/ottl/expression.go +++ b/pkg/ottl/expression.go @@ -27,14 +27,20 @@ func (e Expr[K]) Eval(ctx context.Context, tCtx K) (any, error) { return e.exprFunc(ctx, tCtx) } +// Getter resolves a value at runtime without performing any type checking on the value that is returned. type Getter[K any] interface { + // Get retrieves a value of type 'Any' and returns an error if there are any issues during retrieval. Get(ctx context.Context, tCtx K) (any, error) } +// Setter allows setting an untyped value on a predefined field within some data at runtime. type Setter[K any] interface { + // Set sets a value of type 'Any' and returns an error if there are any issues during the setting process. Set(ctx context.Context, tCtx K, val any) error } +// GetSetter is an interface that combines the Getter and Setter interfaces. +// It should be used to represent the ability to both get and set a value. type GetSetter[K any] interface { Getter[K] Setter[K] @@ -284,6 +290,7 @@ func (g StandardBoolGetter[K]) Get(ctx context.Context, tCtx K) (bool, error) { // FunctionGetter uses a function factory to return an instantiated function as an Expr. type FunctionGetter[K any] interface { + // Get returns a function as an Expr[K] built with the provided Arguments Get(args Arguments) (Expr[K], error) }