Documentation ¶
Index ¶
- Variables
- type BuffPrinter
- type Transformer
- func (t *Transformer) RunStringUnsafe(function string, payload interface{}) (interface{}, []string, error)
- func (t *Transformer) Transform(function string, payload interface{}) (interface{}, []string, error)
- func (t *Transformer) TransformUsingUnderscoreJs(function string, payload interface{}) (interface{}, []string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrFunctionNotFound = errors.New("the transform function is not found, please define it or rename the existing function")
View Source
var ErrMaxExecutionTimeElapsed = errors.New("script execution time elapsed 10 seconds")
Functions ¶
This section is empty.
Types ¶
type BuffPrinter ¶
type BuffPrinter struct { Buff *strings.Builder BuffOutPrint func(s string) BuffErrPrint func(s string) }
BuffPrinter implements the console.Printer interface that writes to a buffer.
func NewBufferPrinter ¶
func NewBufferPrinter() *BuffPrinter
func (*BuffPrinter) Format ¶
func (b *BuffPrinter) Format() []string
type Transformer ¶
type Transformer struct {
// contains filtered or unexported fields
}
func NewTransformer ¶
func NewTransformer(r *goja.Runtime) *Transformer
func (*Transformer) RunStringUnsafe ¶
func (t *Transformer) RunStringUnsafe(function string, payload interface{}) (interface{}, []string, error)
func (*Transformer) Transform ¶
func (t *Transformer) Transform(function string, payload interface{}) (interface{}, []string, error)
Transform mutates the payload by the passed function The output of Transform should be idempotent
func (*Transformer) TransformUsingUnderscoreJs ¶
func (t *Transformer) TransformUsingUnderscoreJs(function string, payload interface{}) (interface{}, []string, error)
TransformUsingUnderscoreJs downloads the underscore js library and then mutates the payload by the passed function. The output of TransformUsingUnderscoreJs should be idempotent
Click to show internal directories.
Click to hide internal directories.