Documentation
¶
Overview ¶
Package jsonata provides a version management system for multiple JSONata implementations
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AvailableVersions ¶
func AvailableVersions() []string
AvailableVersions returns a sorted list of available JSONata versions
func LatestVersion ¶
func LatestVersion() string
LatestVersion returns the latest available version string
func RegisterVersion ¶
func RegisterVersion(version string, factory func() JSONataInstance)
RegisterVersion registers a JSONata version implementation
Types ¶
type Expression ¶
type Expression interface { // Evaluate evaluates the expression against JSON input with optional bindings Evaluate(inputJSON []byte, bindings map[string]interface{}) ([]byte, error) // SetMaxDepth sets the maximum recursion depth SetMaxDepth(maxDepth int) // SetMaxTime sets the maximum execution time in milliseconds SetMaxTime(maxMs int) // SetMaxRange sets the maximum range size SetMaxRange(maxRange int) // Assign assigns a value to a variable in the expression's environment Assign(name string, value interface{}) // RegisterFunction registers a custom function RegisterFunction(name string, implementation interface{}, signature string) error // AST returns the abstract syntax tree of the expression AST() interface{} // Errors returns any parser errors (for recovery mode) Errors() []error }
Expression represents a compiled JSONata expression that can be evaluated
type JSONataInstance ¶
type JSONataInstance interface { // Version returns the version string of this JSONata instance Version() string // Compile compiles a JSONata expression string into an executable Expression Compile(expr string, recoveryMode bool) (Expression, error) // Parse parses a JSONata expression into an AST Parse(expr string) (interface{}, error) // ParseWithRecovery parses with error recovery enabled ParseWithRecovery(expr string) (interface{}, error) // RegisterGlobalFunction registers a custom function globally for all expressions RegisterGlobalFunction(name string, implementation interface{}, signature string) error // SetDefaultMaxDepth sets the global default maximum recursion depth for all new expressions SetDefaultMaxDepth(maxDepth int) // SetDefaultMaxTime sets the global default maximum execution time for all new expressions (in milliseconds) SetDefaultMaxTime(maxMs int) // SetDefaultMaxRange sets the global default maximum size for range expressions for all new expressions SetDefaultMaxRange(maxRange int) // Does this JSON contain the special undefined value? IsUndefined(value []byte) bool // Make a JSONata error (generally from a user-defined function) MakeError(code string, message string) error }
JSONataInstance represents a specific version of JSONata with its exported APIs
func Open ¶
func Open(version string) (JSONataInstance, error)
Open returns a JSONata instance for the specified version
func OpenLatest ¶
func OpenLatest() (JSONataInstance, error)
OpenLatest returns a JSONata instance for the latest available version
Directories
¶
Path | Synopsis |
---|---|
Package jsonata is a query and transformation language for JSON.
|
Package jsonata is a query and transformation language for JSON. |
jlib
Package jlib implements the JSONata function library.
|
Package jlib implements the JSONata function library. |
jparse
Package jparse converts JSONata expressions to abstract syntax trees.
|
Package jparse converts JSONata expressions to abstract syntax trees. |
jtypes
Package jtypes (golint)
|
Package jtypes (golint) |
Click to show internal directories.
Click to hide internal directories.