MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / Replace

Method Replace

internal/controller/runtime/patch.go:87–101  ·  view source on GitHub ↗

Replace appends a "replace" operation to patch. > The "replace" operation replaces the value at the target location > with a new value. > > The target location MUST exist for the operation to be successful.

(path ...string)

Source from the content-addressed store, hash-verified

85// >
86// > The target location MUST exist for the operation to be successful.
87func (patch *JSON6902) Replace(path ...string) func(value any) *JSON6902 {
88 i := len(*patch)
89 f := func(value any) *JSON6902 {
90 (*patch)[i] = map[string]any{
91 "op": "replace",
92 "path": patch.pointer(path...),
93 "value": value,
94 }
95 return patch
96 }
97
98 *patch = append(*patch, f)
99
100 return f
101}
102
103// Bytes returns the JSON representation of patch.
104func (patch *JSON6902) Bytes() ([]byte, error) { return patch.Data(nil) }

Callers 2

TestJSON6902Function · 0.80
ApplyFunction · 0.80

Calls 1

pointerMethod · 0.95

Tested by 1

TestJSON6902Function · 0.64