Documentation ¶
Overview ¶
jsonnet is a simple Go wrapper for the JSonnet VM.
Index ¶
- func Version() string
- type ImportCallback
- type JsonValue
- func (v *JsonValue) ArrayAppend(item *JsonValue)
- func (v *JsonValue) Extract() interface{}
- func (v *JsonValue) ExtractBool() (bool, bool)
- func (v *JsonValue) ExtractNull() bool
- func (v *JsonValue) ExtractNumber() (float64, bool)
- func (v *JsonValue) ExtractString() (string, bool)
- func (v *JsonValue) ObjectAppend(key string, value *JsonValue)
- type NativeCallback
- type VM
- func (vm *VM) Destroy()
- func (vm *VM) EvaluateFile(filename string) (string, error)
- func (vm *VM) EvaluateSnippet(filename, snippet string) (string, error)
- func (vm *VM) ExtCode(key, val string)
- func (vm *VM) ExtVar(key, val string)
- func (vm *VM) FormatFile(filename string) (string, error)
- func (vm *VM) FormatIndent(n int)
- func (vm *VM) FormatSnippet(filename, snippet string) (string, error)
- func (vm *VM) GcGrowthTrigger(v float64)
- func (vm *VM) GcMinObjects(v uint)
- func (vm *VM) ImportCallback(f ImportCallback)
- func (vm *VM) JpathAdd(path string)
- func (vm *VM) MaxStack(v uint)
- func (vm *VM) MaxTrace(v uint)
- func (vm *VM) NativeCallback(name string, params []string, f interface{})
- func (vm *VM) NativeCallbackRaw(name string, params []string, f NativeCallback)
- func (vm *VM) NewArray() *JsonValue
- func (vm *VM) NewBool(v bool) *JsonValue
- func (vm *VM) NewJson(value interface{}) *JsonValue
- func (vm *VM) NewNull() *JsonValue
- func (vm *VM) NewNumber(v float64) *JsonValue
- func (vm *VM) NewObject() *JsonValue
- func (vm *VM) NewString(v string) *JsonValue
- func (vm *VM) StringOutput(v bool)
- func (vm *VM) TlaCode(key, val string)
- func (vm *VM) TlaVar(key, val string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ImportCallback ¶
type JsonValue ¶
type JsonValue struct {
// contains filtered or unexported fields
}
JsonValue represents a jsonnet JSON object.
func (*JsonValue) ArrayAppend ¶
func (*JsonValue) ExtractBool ¶
func (*JsonValue) ExtractNull ¶
ExtractNull returns true iff the value is null
func (*JsonValue) ExtractNumber ¶
func (*JsonValue) ExtractString ¶
ExtractString returns the string value and true if the value was a string
func (*JsonValue) ObjectAppend ¶
type NativeCallback ¶
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
func (*VM) EvaluateFile ¶
Evaluate a file containing Jsonnet code, return a JSON string.
func (*VM) EvaluateSnippet ¶
Evaluate a string containing Jsonnet code, return a JSON string.
func (*VM) FormatFile ¶
Format a file containing Jsonnet code, return a JSON string.
func (*VM) FormatIndent ¶
Indentation level when reformatting (number of spaces)
func (*VM) FormatSnippet ¶
Format a string containing Jsonnet code, return a JSON string.
func (*VM) GcGrowthTrigger ¶
Run the garbage collector after this amount of growth in the number of objects.
func (*VM) GcMinObjects ¶
Set the number of objects required before a garbage collection cycle is allowed.
func (*VM) ImportCallback ¶
func (vm *VM) ImportCallback(f ImportCallback)
Override the callback used to locate imports.
func (*VM) NativeCallback ¶
NativeCallback is a helper around NativeCallbackRaw that uses `reflect` to convert argument and result types to/from JsonValue. `f` is expected to be a function that takes argument types supported by `(*JsonValue).Extract` and returns `(x, error)` where `x` is a type supported by `NewJson`.
func (*VM) NativeCallbackRaw ¶
func (vm *VM) NativeCallbackRaw(name string, params []string, f NativeCallback)
func (*VM) StringOutput ¶
Expect a string as output and don't JSON encode it.
Directories ¶
Path | Synopsis |
---|---|
Command line tool to try evaluating JSonnet.
|
Command line tool to try evaluating JSonnet. |
A program to stress the JSonnet VM and its cgo wrappings.
|
A program to stress the JSonnet VM and its cgo wrappings. |