MCPcopy Index your code
hub / github.com/go-openapi/jsonpointer / SetForToken

Function SetForToken

pointer.go:478–482  ·  view source on GitHub ↗

SetForToken sets a value for a json pointer token 1 level deep. See [Pointer.Set] for the mutation contract, in particular the handling of the RFC 6901 "-" token on slices.

(document any, decodedToken string, value any, opts ...Option)

Source from the content-addressed store, hash-verified

476// See [Pointer.Set] for the mutation contract, in particular the handling of the RFC 6901 "-" token
477// on slices.
478func SetForToken(document any, decodedToken string, value any, opts ...Option) (any, error) {
479 o := optionsWithDefaults(opts)
480
481 return setSingleImpl(document, value, decodedToken, o.provider)
482}
483
484func getSingleImpl(node any, decodedToken string, nameProvider NameProvider) (any, reflect.Kind, error) {
485 rValue := reflect.Indirect(reflect.ValueOf(node))

Callers 3

JSONSetMethod · 0.85
TestSetNodeFunction · 0.85
TestDashToken_SetAppendFunction · 0.85

Calls 2

optionsWithDefaultsFunction · 0.85
setSingleImplFunction · 0.85

Tested by 3

JSONSetMethod · 0.68
TestSetNodeFunction · 0.68
TestDashToken_SetAppendFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…