Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var JSProgramCache *caches.LoadingCache
JSProgramCache caches *goja.Program. A *goja.Program is compiled javascript and it can be used across multiple goroutines and across different *goja.Runtime. If default loading cache capacity is not desirable, change JSProgramCache to a loading cache with a different capacity at package init time. Be mindful this will be shared across all use cases inside your process.
var NodeToJSONCache *caches.LoadingCache
NodeToJSONCache caches *idr.Node to JSON translations.
var OmniV21CustomFuncs = map[string]customfuncs.CustomFuncType{ "copy": CopyFunc, "javascript": JavaScript, "javascript_with_context": JavaScriptWithContext, }
OmniV21CustomFuncs contains 'omni.2.1' specific custom funcs.
Functions ¶
func CopyFunc ¶
func CopyFunc(_ *transformctx.Ctx, n *idr.Node) (interface{}, error)
CopyFunc copies the current contextual idr.Node and returns it as a JSON marshaling friendly interface{}.
func JavaScript ¶
func JavaScript(ctx *transformctx.Ctx, js string, args ...interface{}) (interface{}, error)
JavaScript is a custom_func that runs a javascript with optional arguments and without contextual '_node' JSON provided.
func JavaScriptWithContext ¶
func JavaScriptWithContext(_ *transformctx.Ctx, n *idr.Node, js string, args ...interface{}) (interface{}, error)
JavaScriptWithContext is a custom_func that runs a javascript with optional arguments and with contextual '_node' JSON, if idr.Node is provided.
Types ¶
This section is empty.