jsonnet

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertObjectToMap

func ConvertObjectToMap(obj *astext.Object) (map[string]interface{}, error)

ConvertObjectToMap converts an object to a map.

func DecodeValue

func DecodeValue(s string) (interface{}, error)

DecodeValue decodes a string to an interface value. nolint: gocyclo

func FieldID

func FieldID(field astext.ObjectField) (string, error)

FieldID returns the id for an object field.

func FindObject

func FindObject(object *astext.Object, path []string) (*astext.Object, error)

FindObject finds a path in an object.

func HasField

func HasField(object *astext.Object, name string) bool

HasField returns true if the object has a field.

func Import

func Import(filename string) (*astext.Object, error)

Import imports jsonnet from a path.

func ImportFromFs

func ImportFromFs(filename string, fs afero.Fs) (*astext.Object, error)

ImportFromFs imports jsonnet object from a path on an afero filesystem.

func ImportNodeFromFs

func ImportNodeFromFs(filename string, fs afero.Fs) (ast.Node, error)

ImportNodeFromFs imports jsonnet node from a path on an afero filesystem.

func Parse

func Parse(filename, src string) (*astext.Object, error)

Parse converts a jsonnet snippet to AST Object.

func ParseNode

func ParseNode(filename, src string) (ast.Node, error)

ParseNode converts a jsonnet snippet to AST node.

func Set

func Set(object *astext.Object, path []string, value ast.Node) error

Set sets an object key at path to a value.

Types

type VM

type VM struct {
	// UseMemoryImporter forces the vm to use a memory importer rather than the
	// file import.
	UseMemoryImporter bool
	Fs                afero.Fs
	// contains filtered or unexported fields
}

VM is a ksonnet wrapper for the jsonnet VM.

func NewVM

func NewVM(opts ...VMOpt) *VM

NewVM creates an instance of VM.

func (*VM) AddJPath

func (vm *VM) AddJPath(paths ...string)

AddJPath adds JPaths to the jsonnet VM.

func (*VM) EvaluateSnippet

func (vm *VM) EvaluateSnippet(name, snippet string) (string, error)

EvaluateSnippet evaluates a jsonnet snippet.

func (*VM) ExtCode

func (vm *VM) ExtCode(key, value string)

ExtCode adds ExtCode to the jsonnet VM.

func (*VM) ExtVar

func (vm *VM) ExtVar(key, value string)

ExtVar adds ExtVar to the jsonnet VM.

func (*VM) TLACode

func (vm *VM) TLACode(key, value string)

TLACode adds TLACode to the jsonnet VM.

func (*VM) TLAVar

func (vm *VM) TLAVar(key, value string)

TLAVar adds TLAVar to the jsonnet VM.

type VMOpt

type VMOpt func(*VM)

VMOpt is an option for configuring VM.

Jump to

Keyboard shortcuts

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