ypatch

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CypressPatchTarget

type CypressPatchTarget struct {
	Client yt.CypressClient
	DryRun bool
}

func (*CypressPatchTarget) ApplyPatch

func (t *CypressPatchTarget) ApplyPatch(ctx context.Context, path ypath.Path, patch Patch) error

func (*CypressPatchTarget) ApplyPatchSet

func (t *CypressPatchTarget) ApplyPatchSet(ctx context.Context, path ypath.Path, patchSet PatchSet) error

func (*CypressPatchTarget) SetNode added in v0.35.0

func (t *CypressPatchTarget) SetNode(ctx context.Context, dst ypath.YPath, value any, options *yt.SetNodeOptions) error

type Patch

type Patch []PatchOperation

Patch represents patch with RFC-6902 json patch semantics.

func BuildPatch

func BuildPatch(before, after any, options *PatchOptions) Patch

BuildPatch constructs (mostly correct) patch to convert "before" into "after".

type PatchOp

type PatchOp string
const (
	PatchOpAdd     PatchOp = "add"
	PatchOpCopy    PatchOp = "copy"
	PatchOpMove    PatchOp = "move"
	PatchOpRemove  PatchOp = "remove"
	PatchOpReplace PatchOp = "replace"
	PatchOpTest    PatchOp = "test"
)

type PatchOperation

type PatchOperation struct {
	Op    PatchOp    `json:"op" yson:"op"`
	Path  ypath.Path `json:"path" yson:"path"`
	From  ypath.Path `json:"from,omitempty" yson:"from,omitempty"`
	Value any        `json:"value,omitempty" yson:"value,omitempty"`
}

func Add

func Add(path ypath.Path, value any) PatchOperation

func Copy

func Copy(path, from ypath.Path) PatchOperation

func Move

func Move(path, from ypath.Path) PatchOperation

func Remove

func Remove(path ypath.Path) PatchOperation

func Replace

func Replace(path ypath.Path, value any) PatchOperation

func ReplaceOrRemove

func ReplaceOrRemove[T any](path ypath.Path, value *T) PatchOperation

func Test

func Test(path ypath.Path, value any) PatchOperation

type PatchOptions

type PatchOptions struct {
	WithTest bool
}

type PatchSet

type PatchSet map[ypath.Path]Patch

PatchSet represents series of patches which are applied lexicographically. NOTE: "<>//..." is applied after all "//...".

func (PatchSet) AddPatch

func (p PatchSet) AddPatch(path ypath.Path, patch Patch)

func (PatchSet) AddPatchSet

func (p PatchSet) AddPatchSet(patchSet PatchSet)

type PatchTarget

type PatchTarget interface {
	ApplyPatch(ctx context.Context, path ypath.Path, patch Patch) error
	ApplyPatchSet(ctx context.Context, path ypath.Path, patchSet PatchSet) error
}

Jump to

Keyboard shortcuts

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