Documentation
¶
Overview ¶
Package jsonatatranslator implements definition.Translator using the JSONata expression language.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Provider = provider{}
Provider is the exported symbol the plugin manager looks up.
Functions ¶
func New ¶
func New(_ context.Context, _ map[string]string) (definition.Translator, func() error, error)
New constructs a Translator. config has no recognised keys yet; accepted for interface consistency.
Types ¶
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator implements definition.Translator by compiling (with caching) and evaluating JSONata expressions. The artifact passed to Translate is the raw JSONata expression text; payload is the JSON fragment to transform.
func (*Translator) Translate ¶
Translate compiles (with caching) the JSONata expression carried in artifact and evaluates it against payload, returning the transformed JSON bytes. ctx is accepted for interface consistency; jsonata-go does not support context cancellation, so it is not forwarded to the evaluator.
Access to the cached expression is serialized — see cachedExpr. The non-nil bindings map also makes Evaluate allocate a fresh per-call frame instead of reusing the expression's shared one.