sets

package
v0.0.0-...-8789a92 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TagPatchKey specify the primary key of the list items
	TagPatchKey = "patchKey"
	// TagPatchStrategy specify a strategy of the strategic merge patch
	TagPatchStrategy = "patchStrategy"

	// StrategyRetainKeys notes on the strategic merge patch using the retainKeys strategy
	StrategyRetainKeys = "retainKeys"
	// StrategyReplace notes on the strategic merge patch will allow replacing list
	StrategyReplace = "replace"
	// StrategyJSONPatch notes on the strategic merge patch will follow the RFC 6902 to run JsonPatch
	StrategyJSONPatch = "jsonPatch"
	// StrategyJSONMergePatch notes on the strategic merge patch will follow the RFC 7396 to run JsonMergePatch
	StrategyJSONMergePatch = "jsonMergePatch"
)

Variables

This section is empty.

Functions

func IsJSONMergePatch

func IsJSONMergePatch(patcher cue.Value) bool

IsJSONMergePatch check if patcher is json merge patch

func IsJSONPatch

func IsJSONPatch(patcher cue.Value) bool

IsJSONPatch check if patcher is json patch

func LabelStr

func LabelStr(label ast.Label) string

LabelStr get the string label

func ListOpen

func ListOpen(expr ast.Node) ast.Node

ListOpen enable the cue list can add elements.

func LookUpAll

func LookUpAll(node ast.Node, paths ...string) []ast.Node

LookUpAll look up all the nodes by paths

func OpenBaiscLit

func OpenBaiscLit(val cue.Value) (*ast.File, error)

OpenBaiscLit make that the basicLit can be modified. nolint:staticcheck

func OpenListLit

func OpenListLit(val cue.Value) (*ast.File, error)

OpenListLit make that the listLit can be modified. nolint:staticcheck

func OptBytesToString

func OptBytesToString(node ast.Node) ast.Node

OptBytesToString convert cue bytes to string.

func PreprocessBuiltinFunc

func PreprocessBuiltinFunc(root ast.Node, name string, process func(values []ast.Node) (ast.Expr, error)) error

PreprocessBuiltinFunc preprocess builtin function in cue file.

func StrategyUnify

func StrategyUnify(base, patch cue.Value, options ...UnifyOption) (ret cue.Value, err error)

StrategyUnify unify the objects by the strategy

func ToFile

func ToFile(n ast.Node) (*ast.File, error)

ToFile convert ast.Node to ast.File

func ToString

func ToString(v cue.Value, opts ...func(node ast.Node) ast.Node) (string, error)

ToString convert cue.Value to string

Types

type UnifyByJSONMergePatch

type UnifyByJSONMergePatch struct{}

UnifyByJSONMergePatch unify by json patch following RFC 7396

func (UnifyByJSONMergePatch) ApplyToOption

func (op UnifyByJSONMergePatch) ApplyToOption(params *UnifyParams)

ApplyToOption apply to option

type UnifyByJSONPatch

type UnifyByJSONPatch struct{}

UnifyByJSONPatch unify by json patch following RFC 6902

func (UnifyByJSONPatch) ApplyToOption

func (op UnifyByJSONPatch) ApplyToOption(params *UnifyParams)

ApplyToOption apply to option

type UnifyOption

type UnifyOption interface {
	ApplyToOption(params *UnifyParams)
}

UnifyOption defines the option for unify

func CreateUnifyOptionsForPatcher

func CreateUnifyOptionsForPatcher(patcher cue.Value) (options []UnifyOption)

CreateUnifyOptionsForPatcher create unify options for patcher

type UnifyParams

type UnifyParams struct {
	PatchStrategy string
}

UnifyParams params for unify

Jump to

Keyboard shortcuts

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