customfuncs

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
var NodeToJSONCache *caches.LoadingCache

NodeToJSONCache caches *idr.Node to JSON translations.

View Source
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL