yamlutil

package
v0.0.0-...-4a0a1b7 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OpInvalid is invalid.
	OpInvalid = OpType("")
	// OpSet sets a property.
	OpSet = OpType("set")
)

Variables

This section is empty.

Functions

func Apply

func Apply(b []byte, ops ...Op) ([]byte, error)

Apply applies ops.

func Apply1

func Apply1(astFile *ast.File, op Op) error

Apply1 applies a single op.

func Editable

func Editable(b []byte) error

Editable returns nil error if the YAML is safely editable.

func Query

func Query(b []byte, pathStr string) ([]byte, error)

Query returns the filtered YAML.

func SplitPath

func SplitPath(s string) (string, string)

SplitPath splits a yaml path into the parent and the base.

Types

type Op

type Op struct {
	Type  OpType
	Path  string // like $.ssh.localPort
	Value string
}

Op is an op.

type OpType

type OpType string

OpType is the operator type.

Jump to

Keyboard shortcuts

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