jsonnet

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 23 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(path string, impl types.JsonnetImplementation, data string, opts Opts) (string, error)

Evaluate renders the given jsonnet into a string If cache options are given, a hash from the data will be computed and the resulting string will be cached for future retrieval

func EvaluateFile

func EvaluateFile(impl types.JsonnetImplementation, jsonnetFile string, opts Opts) (string, error)

EvaluateFile evaluates the Jsonnet code in the given file and returns the result in JSON form. It disregards opts.ImportPaths in favor of automatically resolving these according to the specified file.

func FindFiles added in v0.22.0

func FindFiles(target string, excludes []glob.Glob) ([]string, error)

FindFiles takes a file / directory and finds all Jsonnet files

func FindImporterForFiles added in v0.24.0

func FindImporterForFiles(root string, files []string) ([]string, error)

FindImporterForFiles finds the entrypoints (main.jsonnet files) that import the given files. It looks through imports transitively, so if a file is imported through a chain, it will still be reported. If the given file is a main.jsonnet file, it will be returned as well.

func Lint added in v0.22.0

func Lint(fds []string, opts *LintOpts) error

Lint takes a list of files and directories, processes them and prints out to stderr if there are linting warnings

func TransitiveImports

func TransitiveImports(dir string) ([]string, error)

TransitiveImports returns all recursive imports of an environment

Types

type FileEvalCache added in v0.18.0

type FileEvalCache struct {
	Directory string
}

FileEvalCache is an evaluation cache that stores its data on the local filesystem

func NewFileEvalCache added in v0.18.0

func NewFileEvalCache(cachePath string) *FileEvalCache

func (*FileEvalCache) Get added in v0.18.0

func (c *FileEvalCache) Get(hash string) (string, error)

func (*FileEvalCache) Store added in v0.18.0

func (c *FileEvalCache) Store(hash, content string) error

type InjectedCode added in v0.12.0

type InjectedCode map[string]string

InjectedCode holds data that is "late-bound" into the VM

func (*InjectedCode) Set added in v0.12.0

func (i *InjectedCode) Set(key, value string)

Set allows to set values on an InjectedCode, even when it is nil

type LintOpts added in v0.22.0

type LintOpts struct {
	// Excludes are a list of globs to exclude files while searching for Jsonnet
	// files
	Excludes []glob.Glob

	// Parallelism determines the number of workers that will process files
	Parallelism int

	Out io.Writer
}

LintOpts modifies the behaviour of Lint

type Modifier added in v0.7.0

type Modifier func(vm *jsonnet.VM) error

Modifier allows to set optional parameters on the Jsonnet VM. See jsonnet.With* for this.

type Opts added in v0.12.0

type Opts struct {
	MaxStack    int
	ExtCode     InjectedCode
	TLACode     InjectedCode
	ImportPaths []string
	EvalScript  string
	CachePath   string

	CachePathRegexes []*regexp.Regexp
}

Opts are additional properties for the Jsonnet VM

func (Opts) Clone added in v0.14.0

func (o Opts) Clone() Opts

Clone returns a deep copy of Opts

func (Opts) PathIsCached added in v0.18.0

func (o Opts) PathIsCached(path string) bool

PathIsCached determines if a given path is matched by any of the configured cached path regexes If no path regexes are defined, all paths are matched

Directories

Path Synopsis
implementations

Jump to

Keyboard shortcuts

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