jsonpatch

package
v0.1.0-alpha.46 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPatch

func ApplyPatch(original any, patches []Patch) (map[string]any, error)

ApplyPatch applies a series of JSON Patch operations to the original JSON object. RFC 6902 compliance: Operations are atomic - either all succeed or all fail.

func ApplyPatchAndHydrate

func ApplyPatchAndHydrate(original, updated any, patches []Patch) error

Types

type Patch

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

Patch represents a single JSON Patch operation.

func GeneratePatch

func GeneratePatch(before, after any, basePath string) ([]Patch, error)

Jump to

Keyboard shortcuts

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