patch

package
v0.0.0-...-540bb61 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapePatchElement

func EscapePatchElement(element string) string

Types

type Item

type Item struct {
	Op    Operation   `json:"op"`
	Path  Path        `json:"path"`
	Value interface{} `json:"value,omitempty"`
}

func ItemAdd

func ItemAdd(path Path, value interface{}) Item

func ItemRemove

func ItemRemove(path Path) Item

func ItemReplace

func ItemReplace(path Path, value interface{}) Item

type Operation

type Operation string
const (
	AddOperation     Operation = "add"
	ReplaceOperation Operation = "replace"
	RemoveOperation  Operation = "remove"
)

type Patch

type Patch []Item

func NewPatch

func NewPatch(items ...Item) Patch

func (*Patch) Add

func (p *Patch) Add(items ...Item)

func (*Patch) ItemAdd

func (p *Patch) ItemAdd(path Path, value interface{})

func (*Patch) ItemRemove

func (p *Patch) ItemRemove(path Path)

func (*Patch) ItemReplace

func (p *Patch) ItemReplace(path Path, value interface{})

func (Patch) Marshal

func (p Patch) Marshal() ([]byte, error)

type Path

type Path []string

func NewPath

func NewPath(items ...string) Path

func (Path) MarshalJSON

func (p Path) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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