Documentation
¶
Overview ¶
Package navigation reads a JSON pointer through the library's parsed model as jsonpointer.GetTarget's walk reads it, and says where that walk leaves the model for the raw YAML an object was built from. Tests such as TestWalk_AnswersAsTheWholeReadDoes hold each reading to the library's.
The library finds a key in raw YAML by comparing a mapping's keys in order, taking a repeated one's first (docs/parser-library.md#duplicate-key), so a reader asking it once per reference pays the square of a wide mapping (GitHub #778). Knowing where the walk leaves the model lets a reader stop there, or read on through an index.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIndex ¶
IsIndex reports whether the library types token as an index: ASCII digits, with no leading zero unless the token is "0". It reads a token alike escaped or decoded, since no escape decodes to a digit.
func Step ¶
Step returns what node holds under the one token, as the library's walk reads it on to the next, and false where it holds nothing. Only the empty token is read below an envelope keyed by the empty string, since the library reads the pointer "/" as the root; on raw YAML the empty token still answers the node itself. A model held by value, such as an operation's responses, comes back as a pointer to a copy: the walk reads on from its address, where its methods navigate it (GitHub #779).
Types ¶
type Reading ¶
type Reading int
Reading is how the library's read of one token from a node goes on.
const ( // Answering is a read a field or an entry answers, or that fails there. Answering Reading = iota // Leaving is a read of the token, and the rest after it, in raw YAML. Leaving // Retried is a read of an index token as a key with the rest below it, // and as an index once that fails, so what answers it turns on the rest. Retried )
func ReadingOf ¶
ReadingOf returns how the library's read of token from node goes on, and the raw YAML it is read in where it leaves the model, with the tokens after it: node itself when it is raw YAML, else the mapping an object was built from where none of its fields or embedded maps answers token. It follows the library's dispatch for one token (getStructTarget, navigateModel), asking each map the library asks through the map's own method.