json_patch

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPatch

func ApplyPatch(jsonDoc any, patch []PatchOperation) ([]byte, error)

func TestApplyPatch

func TestApplyPatch(t *testing.T)

Types

type Document added in v1.1.0

type Document []Patch

func (*Document) Add added in v1.1.0

func (pd *Document) Add(op, path string, value any) *Document

func (*Document) Json added in v1.1.0

func (pd *Document) Json() ([]byte, error)

type Patch added in v1.1.0

type Patch struct {
	Op    string `json:"op"`
	Path  string `json:"path"`
	Value any    `json:"value,omitempty"`
}

type PatchOperation

type PatchOperation struct {
	Op   string `json:"op"`
	Path string `json:"path"`
	// +kubebuilder:validation:Schemaless
	// +kubebuilder:pruning:PreserveUnknownFields
	Value json.RawMessage `json:"value,omitempty"`
}

func (*PatchOperation) DeepCopy

func (in *PatchOperation) DeepCopy() *PatchOperation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PatchOperation.

func (*PatchOperation) DeepCopyInto

func (in *PatchOperation) DeepCopyInto(out *PatchOperation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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