Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface {
// Append adds path component to the end of path.
// Builder state is cloned before adding component, so original builder instance is different from
// returned one.
Append(c ...Component) Builder
// Build creates Path using current state.
// Subsequent invocation of this function will always produce new Path instance, but with same content.
Build() Path
}
Builder provides convenient way to construct Path using fluent builder pattern.
type Codec ¶ added in v1.0.67
type Codec interface {
Parser() Parser
Serializer() Serializer
}
Codec is interface that combines Parser and Serializer
type Component ¶
type Component interface {
// IsInsertAfterLast returns true if this path component points to non-existent item after last element in the list.
// This is required by JSON pointer (rfc6901) during append to the end of list.
IsInsertAfterLast() bool
// IsNumeric returns true if name is numeric value according to rfc6901
IsNumeric() bool
// NumericValue gets number that points to array element with the zero-based index.
// Only valid if IsNumeric returns true.
NumericValue() int
// Value returns canonical value of this component.
Value() string
}
type Parser ¶
type Parser interface {
// Parse parses source string into Path.
// Any error encountered during parse is returned to caller.
Parse(string) (Path, error)
// MustParse parses source string into Path.
// Any error encountered during parse will cause panic.
MustParse(string) Path
}
Parser interface is implemented by different Path syntax parsers.
type Path ¶
type Path interface {
fmt.Stringer
// Components returns copy of path components in this path
Components() []Component
// IsEmpty returns true if Path does not have any components.
IsEmpty() bool
// Last gets very last path Component, panics if path is empty.
Last() Component
}
type Serializer ¶
type Serializer interface {
// Serialize serializes path into lexical representation
Serialize(Path) string
}
Serializer is interface that allows to serialize Path into lexical form
Click to show internal directories.
Click to hide internal directories.