Documentation
¶
Index ¶
- Variables
- func EnableDebug()
- func FindClosestCeiling[S ~[]E, E, T any](xs S, target T, cmp func(E, T) int) (int, bool)
- func FindClosestFloor[S ~[]E, E, T any](xs S, target T, cmp func(E, T) int) (int, bool)
- func OnDebug(f func())
- type ItemNode
- type JSONItemNode
- type JSONNode
- type JSONQuery
- type Node
- type PathNodeComplementor
- type PathNodeMap
- type PathNodeMapEntry
- type PathNodePair
- type Position
- type Queryer
- type Result
- type YAMLItemNode
- type YAMLNode
- type YamlQuery
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNotFound = errors.New("NotFound")
)
Functions ¶
func EnableDebug ¶
func EnableDebug()
func FindClosestCeiling ¶
FindClosestCeiling finds the smallest element of xs not less than target.
xs must be sorted in increasing order, defined by cmp. if cmp(a, b) < 0 then value of a < b and cmp(a, b) >= 0 then value of a >= b.
func FindClosestFloor ¶
FindClosestFloor finds the largest element of xs not exceeding target.
xs must be sorted in increasing order, defined by cmp. if cmp(a, b) < 0 then value of a < b and cmp(a, b) >= 0 then value of a >= b.
Types ¶
type JSONItemNode ¶
type JSONItemNode struct {
JSONNode
// contains filtered or unexported fields
}
func (JSONItemNode) ItemIndex ¶
func (n JSONItemNode) ItemIndex() int
func (JSONItemNode) ItemPath ¶
func (n JSONItemNode) ItemPath() string
type JSONNode ¶
type JSONNode struct {
// contains filtered or unexported fields
}
func NewJSONNode ¶
func (JSONNode) AsItemNode ¶
func (n JSONNode) AsItemNode() (*JSONItemNode, bool)
type PathNodeComplementor ¶
type PathNodeComplementor struct {
// contains filtered or unexported fields
}
func NewPathNodeComplementor ¶
func NewPathNodeComplementor(nodeMap *PathNodeMap) *PathNodeComplementor
func (PathNodeComplementor) Complement ¶
func (c PathNodeComplementor) Complement() []Node
Complement generates missing nodes to find nodes by offset.
type PathNodeMap ¶
type PathNodeMap struct {
// contains filtered or unexported fields
}
Path to Node list map.
func NewPathNodeMap ¶
func NewPathNodeMap() *PathNodeMap
func (*PathNodeMap) Add ¶
func (m *PathNodeMap) Add(node Node)
func (*PathNodeMap) Find ¶
func (m *PathNodeMap) Find(offset int) (*PathNodePair, bool)
Find finds node containing offset.
If multiple nodes are found, returns the one with the smaller range.
func (PathNodeMap) SortedNodes ¶
func (m PathNodeMap) SortedNodes() []Node
type PathNodeMapEntry ¶
type PathNodeMapEntry struct {
Nodes []Node
}
func (PathNodeMapEntry) In ¶
func (e PathNodeMapEntry) In(offset int) bool
func (PathNodeMapEntry) IsValid ¶
func (e PathNodeMapEntry) IsValid() bool
func (PathNodeMapEntry) Size ¶
func (e PathNodeMapEntry) Size() int
type PathNodePair ¶
type Position ¶
type Position struct {
// Line number, 1-based.
Line int `json:"line"`
// Column number, 1-based.
Column int `json:"column"`
// Offset of document, 0-based.
Offset int `json:"offset"`
}
func NewFirstPosition ¶
func NewFirstPosition() *Position
func NewLastPosition ¶
type YAMLItemNode ¶
type YAMLItemNode struct {
YAMLNode
// contains filtered or unexported fields
}
func (YAMLItemNode) Describe ¶
func (n YAMLItemNode) Describe() string
func (YAMLItemNode) ItemIndex ¶
func (n YAMLItemNode) ItemIndex() int
func (YAMLItemNode) ItemPath ¶
func (n YAMLItemNode) ItemPath() string
type YAMLNode ¶
type YAMLNode struct {
// contains filtered or unexported fields
}
func (YAMLNode) AsItemNode ¶
func (n YAMLNode) AsItemNode() (*YAMLItemNode, bool)
Click to show internal directories.
Click to hide internal directories.