maps

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	XGoPackage = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Name  string
	Value any
}

Node represents a named value in a DQL query tree.

func (Node) XGo_Any added in v1.6.6

func (n Node) XGo_Any(name string) NodeSet

XGo_Any returns a NodeSet containing all descendant nodes (including the node itself) with the specified name. If name is "", it returns all nodes.

  • .**.name
  • .**.“element-name”
  • .**.*

func (Node) XGo_Attr__0 added in v1.6.6

func (n Node) XGo_Attr__0(name string) any

XGo_Attr returns the value of the specified attribute from the node. If the attribute does not exist, it returns nil.

  • $name
  • $“attr-name”

func (Node) XGo_Attr__1 added in v1.6.6

func (n Node) XGo_Attr__1(name string) (any, error)

XGo_Attr returns the value of the specified attribute from the node. If the attribute does not exist, it returns ErrNotFound.

  • $name
  • $“attr-name”

func (Node) XGo_Child added in v1.6.6

func (n Node) XGo_Child() NodeSet

XGo_Child returns a NodeSet containing all child nodes of the node.

  • .*

func (Node) XGo_Elem added in v1.6.6

func (n Node) XGo_Elem(name string) (ret Node)

XGo_Elem returns the child node with the specified name.

  • .name
  • .“element-name”

func (Node) XGo_hasAttr added in v1.6.6

func (n Node) XGo_hasAttr(name string) bool

_hasAttr returns true if the node has the specified attribute.

type NodeSet

type NodeSet struct {
	Data iter.Seq[Node]
	Err  error
}

NodeSet represents a set of nodes.

func New

func New(doc any) NodeSet

New creates a NodeSet containing a single node from the provided document. The document should be of type map[string]any or []any. If the document type is invalid, it panics.

func NodeSet_Cast

func NodeSet_Cast(seq iter.Seq[Node]) NodeSet

NodeSet(seq) casts a NodeSet from a sequence of nodes.

func Nodes

func Nodes(nodes ...Node) NodeSet

Nodes creates a NodeSet containing the provided nodes.

func Root

func Root(doc Node) NodeSet

Root creates a NodeSet containing the provided root node.

func Source

func Source(r any) (ret NodeSet)

Source creates a NodeSet from various types of sources: - map[string]any: creates a NodeSet containing the single provided node. - []any: creates a NodeSet containing the single provided node. - Node: creates a NodeSet containing the single provided node. - iter.Seq[Node]: directly uses the provided sequence of nodes. - NodeSet: returns the provided NodeSet as is. If the source type is unsupported, it panics.

func (NodeSet) XGo_Any

func (p NodeSet) XGo_Any(name string) NodeSet

XGo_Any returns a NodeSet containing all descendant nodes (including the nodes themselves) with the specified name. If name is "", it returns all nodes.

  • .**.name
  • .**.“element-name”
  • .**.*

func (NodeSet) XGo_Attr__0

func (p NodeSet) XGo_Attr__0(name string) any

XGo_Attr returns the value of the specified attribute from the first node in the NodeSet. It only retrieves the attribute from the first node.

  • $name
  • $“attr-name”

func (NodeSet) XGo_Attr__1

func (p NodeSet) XGo_Attr__1(name string) (val any, err error)

XGo_Attr returns the value of the specified attribute from the first node in the NodeSet. It only retrieves the attribute from the first node.

  • $name
  • $“attr-name”

func (NodeSet) XGo_Child

func (p NodeSet) XGo_Child() NodeSet

XGo_Child returns a NodeSet containing all child nodes of the nodes in the NodeSet.

func (NodeSet) XGo_Elem

func (p NodeSet) XGo_Elem(name string) NodeSet

XGo_Elem returns a NodeSet containing the child nodes with the specified name.

  • .name
  • .“element-name”

func (NodeSet) XGo_Enum

func (p NodeSet) XGo_Enum() iter.Seq[NodeSet]

XGo_Enum returns an iterator over the nodes in the NodeSet.

func (NodeSet) XGo_Select

func (p NodeSet) XGo_Select(name string) NodeSet

XGo_Select returns a NodeSet containing the nodes with the specified name.

  • @name
  • @"element-name"

func (NodeSet) XGo_all

func (p NodeSet) XGo_all() NodeSet

_all returns a NodeSet containing all nodes. It's a cache operation for performance optimization when you need to traverse the nodes multiple times.

func (NodeSet) XGo_first

func (p NodeSet) XGo_first() (Node, error)

_first returns the first node in the NodeSet.

func (NodeSet) XGo_hasAttr

func (p NodeSet) XGo_hasAttr(name string) bool

_hasAttr returns true if the first node in the NodeSet has the specified attribute. It returns false otherwise.

func (NodeSet) XGo_name__0 added in v1.6.6

func (p NodeSet) XGo_name__0() string

_name returns the name of the first node in the NodeSet. empty string is returned if the NodeSet is empty or error occurs.

func (NodeSet) XGo_name__1 added in v1.6.6

func (p NodeSet) XGo_name__1() (ret string, err error)

_name returns the name of the first node in the NodeSet. If the NodeSet is empty, it returns ErrNotFound.

func (NodeSet) XGo_ok added in v1.6.5

func (p NodeSet) XGo_ok() bool

_ok returns true if there is no error in the NodeSet.

func (NodeSet) XGo_one

func (p NodeSet) XGo_one() NodeSet

_one returns a NodeSet containing the first node. It's a performance optimization when you only need the first node (stop early).

func (NodeSet) XGo_single

func (p NodeSet) XGo_single() NodeSet

_single returns a NodeSet containing the single node. If there are zero or more than one nodes, it returns an error. ErrNotFound or ErrMultipleResults is returned accordingly.

func (NodeSet) XGo_value__0 added in v1.6.6

func (p NodeSet) XGo_value__0() any

_value returns the value of the first node in the NodeSet. nil is returned if the NodeSet is empty or error occurs.

func (NodeSet) XGo_value__1 added in v1.6.6

func (p NodeSet) XGo_value__1() (ret any, err error)

_value returns the value of the first node in the NodeSet. If the NodeSet is empty, it returns ErrNotFound.

Jump to

Keyboard shortcuts

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