package jsonpointer
import "github.com/go-openapi/jsonpointer"
Index ¶
- Constants
- func Escape(token string) string
- func GetForToken(document any, decodedToken string) (any, reflect.Kind, error)
- func SetForToken(document any, decodedToken string, value any) (any, error)
- func Unescape(token string) string
- type JSONPointable
- type JSONSetable
- type Pointer
- func New(jsonPointerString string) (Pointer, error)
- func (p *Pointer) DecodedTokens() []string
- func (p *Pointer) Get(document any) (any, reflect.Kind, error)
- func (p *Pointer) IsEmpty() bool
- func (p *Pointer) Offset(document string) (int64, error)
- func (p *Pointer) Set(document any, value any) (any, error)
- func (p *Pointer) String() string
Constants ¶
const ( // ErrPointer is an error raised by the jsonpointer package ErrPointer pointerError = "JSON pointer error" // ErrInvalidStart states that a JSON pointer must start with a separator ("/") ErrInvalidStart pointerError = `JSON pointer must be empty or start with a "` + pointerSeparator // ErrUnsupportedValueType indicates that a value of the wrong type is being set ErrUnsupportedValueType pointerError = "only structs, pointers, maps and slices are supported for setting values" )
Functions ¶
func Escape ¶
Escape escapes a pointer reference token string
func GetForToken ¶
GetForToken gets a value for a json pointer token 1 level deep
func SetForToken ¶
SetForToken gets a value for a json pointer token 1 level deep
func Unescape ¶
Unescape unescapes a json pointer reference token string to the original representation
Types ¶
type JSONPointable ¶
JSONPointable is an interface for structs to implement when they need to customize the json pointer process
type JSONSetable ¶
JSONSetable is an interface for structs to implement when they need to customize the json pointer process
type Pointer ¶
type Pointer struct {
// contains filtered or unexported fields
}
Pointer the json pointer reprsentation
func New ¶
New creates a new json pointer for the given string
func (*Pointer) DecodedTokens ¶
DecodedTokens returns the decoded tokens
func (*Pointer) Get ¶
Get uses the pointer to retrieve a value from a JSON document
func (*Pointer) IsEmpty ¶
IsEmpty returns true if this is an empty json pointer this indicates that it points to the root document
func (*Pointer) Offset ¶
func (*Pointer) Set ¶
Set uses the pointer to set a value from a JSON document
func (*Pointer) String ¶
Pointer to string representation function
Source Files ¶
- Version
- v0.21.1 (latest)
- Published
- Mar 12, 2025
- Platform
- darwin/amd64
- Imports
- 7 packages
- Last checked
- now –
Tools for package owners.