jsonpointer

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package jsonpointer implements representations for JSON Pointer and tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(obj interface{}, pointer string) (interface{}, error)

Get retrieves a value from the obj.

func UnescapeTokenString

func UnescapeTokenString(token string) string

UnescapeTokenString returns unescaped representation of the token.

Types

type JSONPointer

type JSONPointer []Token

JSONPointer is a sequence of Token.

func New

func New(pointer string) (JSONPointer, error)

New parses a pointer string and creates a new JSONPointer.

func (*JSONPointer) Append

func (p *JSONPointer) Append(token Token) *JSONPointer

Append appends the token.

func (*JSONPointer) AppendString

func (p *JSONPointer) AppendString(token string) *JSONPointer

AppendString appends the token.

func (JSONPointer) Clone

func (p JSONPointer) Clone() JSONPointer

Clone returns a duplicate of the JSONPointer.

func (JSONPointer) DotNotation

func (p JSONPointer) DotNotation(bracketIndex bool) string

DotNotation returns dot-notated representation.

func (JSONPointer) EscapedStrings

func (p JSONPointer) EscapedStrings() []string

EscapedStrings returns an array of each token string that is escaped.

func (JSONPointer) Get

func (p JSONPointer) Get(obj interface{}) (value interface{}, err error)

Get retrieves a value from the obj.

func (*JSONPointer) Len

func (p *JSONPointer) Len() int

Len returns the length of tokens.

func (*JSONPointer) Pop

func (p *JSONPointer) Pop() Token

Pop removes last token and return.

func (JSONPointer) String

func (p JSONPointer) String() string

String returns JSON Pointer representation.

func (JSONPointer) Strings

func (p JSONPointer) Strings() []string

Strings returns an array of each token string.

type Token

type Token string

Token is each part of a JSON Pointer.

func NewTokenFromEscaped

func NewTokenFromEscaped(token string) Token

NewTokenFromEscaped returns a new Token from an escaped string.

func (Token) EscapedString

func (t Token) EscapedString() string

EscapedString returns escaped representation of the token.

func (Token) IsIndex

func (t Token) IsIndex() bool

IsIndex returns true if the token is an index like string.

func (Token) IsInt

func (t Token) IsInt() bool

IsInt returns true if the token is an integer like string.

Jump to

Keyboard shortcuts

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