jsonpatch

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyPatches

func ApplyPatches(bytes []byte, applyOpt mo.Option[ApplyOptions], patches ...mo.Option[JSONPatchOperationObject]) mo.Result[[]byte]

func NewAdd

func NewAdd(path string, value any) mo.Option[JSONPatchOperationObject]

func NewPatches

func NewPatches(operations ...mo.Option[JSONPatchOperationObject]) []byte

func NewRemove

func NewRemove(path string) mo.Option[JSONPatchOperationObject]

func NewReplace

func NewReplace(path string, to any) mo.Option[JSONPatchOperationObject]

Types

type ApplyOptions

type ApplyOptions jsonpatch.ApplyOptions

type JSONPatchOperation

type JSONPatchOperation string
const (
	JSONPatchOperationAdd     JSONPatchOperation = "add"
	JSONPatchOperationRemove  JSONPatchOperation = "remove"
	JSONPatchOperationReplace JSONPatchOperation = "replace"
)

type JSONPatchOperationObject

type JSONPatchOperationObject struct {
	Operation JSONPatchOperation `json:"op"`
	Path      string             `json:"path"`
	Value     any                `json:"value,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳