func Escape(token string) string
Escape escapes a pointer reference token string
func GetForToken(document any, decodedToken string) (any, reflect.Kind, error)
GetForToken gets a value for a json pointer token 1 level deep
func SetForToken(document any, decodedToken string, value any) (any, error)
SetForToken gets a value for a json pointer token 1 level deep
func Unescape(token string) string
Unescape unescapes a json pointer reference token string to the original representation
JSONPointable is an interface for structs to implement when they need to customize the json pointer process
type JSONPointable interface { JSONLookup(string) (any, error) }
JSONSetable is an interface for structs to implement when they need to customize the json pointer process
type JSONSetable interface { JSONSet(string, any) error }
Pointer the json pointer reprsentation
type Pointer struct {
// contains filtered or unexported fields
}
func New(jsonPointerString string) (Pointer, error)
New creates a new json pointer for the given string
func (p *Pointer) DecodedTokens() []string
DecodedTokens returns the decoded tokens
func (p *Pointer) Get(document any) (any, reflect.Kind, error)
Get uses the pointer to retrieve a value from a JSON document
func (p *Pointer) IsEmpty() bool
IsEmpty returns true if this is an empty json pointer this indicates that it points to the root document
func (p *Pointer) Offset(document string) (int64, error)
func (p *Pointer) Set(document any, value any) (any, error)
Set uses the pointer to set a value from a JSON document
func (p *Pointer) String() string
Pointer to string representation function