structural

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: BSD-3-Clause Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LIST_ERR listProc = iota // unknown arg
	LIST_AND                 // all apply
	LIST_OR                  // any apply
	LIST_PER                 // pairwise
)

Variables

This section is empty.

Functions

func CountValue added in v0.3.1

func CountValue(val cue.Value) int

func DepthValue added in v0.3.1

func DepthValue(val cue.Value) int

func DiffValue added in v0.3.1

func DiffValue(orig, next cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func FormatCueError

func FormatCueError(err error) string

func FormatOutput

func FormatOutput(val cue.Value, format string) (string, error)

func GetLabel added in v0.3.1

func GetLabel(val cue.Value) cue.Selector

func InjectAttrsValue added in v0.4.0

func InjectAttrsValue(val cue.Value, attr string, kv map[string]string) (cue.Value, error)

func InsertValue added in v0.3.1

func InsertValue(ins, val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func LoadCueInputs added in v0.3.0

func LoadCueInputs(entrypoints []string, ctx *cue.Context, cfg *load.Config) (cue.Value, error)

Loads the entrypoints using the context provided returns the value from the load after validating it

func MaskValue added in v0.3.1

func MaskValue(mask, val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func PatchValue added in v0.3.1

func PatchValue(patch, val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func PickValue added in v0.3.0

func PickValue(pick, from cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

PickValue uses 'pick' to pick a subvalue from 'from' by checking if values unify

func ProcessOutputs added in v0.2.0

func ProcessOutputs(results []GlobResult, opts *flags.RootPflagpole) (err error)

func ReplaceValue added in v0.3.1

func ReplaceValue(repl, val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func TransformValue

func TransformValue(trans, orig cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func UpsertValue added in v0.3.1

func UpsertValue(up, val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

func ValidateValue

func ValidateValue(schema, val cue.Value, opts *flags.RootPflagpole) (bool, error)

func Walk added in v0.2.0

func Walk(v cue.Value, before func(cue.Value) bool, after func(cue.Value), options ...cue.Option)

Walk is an alternative to cue.Value.Walk which handles more field types You can customize this with your own options

Types

type BinaryOpValueFunc added in v0.3.1

type BinaryOpValueFunc func(lhs, rhs cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

type CountResult

type CountResult struct {
	Filename string
	Count    int
}

func CountGlobs added in v0.3.1

func CountGlobs(globs []string, opts *flags.RootPflagpole) ([]CountResult, error)

type Cuest

type Cuest struct {
	// contains filtered or unexported fields
}

func NewCuest

func NewCuest(ops []string, ctx *cue.Context) (*Cuest, error)

Creates a new Cuest object and preloads the structural ops. The ops should be their lowercase name and all are loaded. If 'op' is nil or empty, preloading is skipped.

You can provide your own cue.Context or a new one will be created Keep in mind CUE still requires values to come from the same context.

type DepthResult

type DepthResult struct {
	Filename string
	Depth    int
}

func DepthGlobs added in v0.3.1

func DepthGlobs(globs []string, opts *flags.RootPflagpole) ([]DepthResult, error)

type GlobResult

type GlobResult struct {
	Filename string
	Content  string
	Value    cue.Value
	Error    error
}

func AccumOutputs added in v0.2.0

func AccumOutputs(results []GlobResult, accum string) ([]GlobResult, error)

func BinaryOpGlobs added in v0.3.1

func BinaryOpGlobs(lhs string, rhs []string, opts *flags.RootPflagpole, fn BinaryOpValueFunc) ([]GlobResult, error)

func DiffGlobs added in v0.3.1

func DiffGlobs(orig string, next string, opts *flags.RootPflagpole) ([]GlobResult, error)

func InsertGlobs added in v0.3.1

func InsertGlobs(code string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

func MaskGlobs added in v0.3.1

func MaskGlobs(mask string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

MaskGlobs will mask a subobject from globs on disk

func PatchGlobs added in v0.3.1

func PatchGlobs(patch string, orig string, opts *flags.RootPflagpole) ([]GlobResult, error)

func PickGlobs added in v0.3.1

func PickGlobs(code string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

PickGlobs will pick a subobject from globs on disk

func ReplaceGlobs added in v0.3.1

func ReplaceGlobs(code string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

func TransformGlobs

func TransformGlobs(code string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

func UnaryOpGlobs added in v0.3.1

func UnaryOpGlobs(globs []string, opts *flags.RootPflagpole, fn UnaryOpValueFunc) ([]GlobResult, error)

func UpsertGlobs added in v0.3.1

func UpsertGlobs(code string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

func ValidateGlobs

func ValidateGlobs(schema string, globs []string, opts *flags.RootPflagpole) ([]GlobResult, error)

type Input

type Input struct {
	Original    string
	Entrypoints []string
	Filename    string
	Filetype    string // yaml, json, cue... toml?
	Expression  string // cue expression to select within document
	Content     []byte
	Value       cue.Value
}

func LoadGlobs added in v0.3.0

func LoadGlobs(globs []string) ([]Input, error)

func LoadInput added in v0.3.0

func LoadInput(i *Input, ctx *cue.Context, cfg *load.Config) (*Input, error)

Loads a parsed Input and sets the Content and Value

func ParseInput added in v0.3.0

func ParseInput(arg string) (*Input, error)

Parses arg into an Input. arg can be a value, filename, glob, or - for stdin can be <arg>@<expr> to subselect from the root value can be <entyrpoint>,<endtrypoint>[@<expr>] to support CUE like args

func ReadArg added in v0.3.0

func ReadArg(arg string, ctx *cue.Context, cfg *load.Config) (*Input, error)

func ReadGlobs

func ReadGlobs(globs []string, ctx *cue.Context, cfg *load.Config) ([]*Input, error)

type StatsResult added in v0.2.0

type StatsResult struct {
	Filename string
	Count    int
	Depth    int
}

type UnaryOpValueFunc added in v0.3.1

type UnaryOpValueFunc func(val cue.Value, opts *flags.RootPflagpole) (cue.Value, error)

Jump to

Keyboard shortcuts

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