Documentation
¶
Overview ¶
Package javascript evaluates Spectre response comparator scripts.
Index ¶
- type Evaluator
- func (e *Evaluator) Close()
- func (e *Evaluator) CompareField(target string, reference any, referencePresent bool, candidate any, ...) (matched bool, err error)
- func (e *Evaluator) CompareMessage(target string, reference any, referencePresent bool, candidate any, ...) (matched bool, err error)
- func (e *Evaluator) CompareRPC(target string, reference any, referencePresent bool, candidate any, ...) (matched bool, err error)
- type Program
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator owns the JavaScript runtime for one response comparison. It is confined to its caller because Sobek runtime access is not synchronized.
func (*Evaluator) Close ¶
func (e *Evaluator) Close()
Close releases the evaluator's context watcher.
func (*Evaluator) CompareField ¶
func (e *Evaluator) CompareField( target string, reference any, referencePresent bool, candidate any, candidatePresent bool, ) (matched bool, err error)
CompareField invokes the comparator registered for a protobuf field.
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
Program is an immutable script shared by all response comparisons. It retains no runtime-local callback state.
func NewProgram ¶
NewProgram parses and links a script, then evaluates it once to validate registrations.
func (*Program) NewEvaluator ¶
NewEvaluator creates an isolated evaluator for one response comparison. Re-evaluation must reproduce the registrations used to build the schema plan.