query

package
v0.0.0-...-bae1a90 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectAreas

func CollectAreas(infra *infrastructure.Infrastructure, areasMap map[string]*infrastructure.Area, query string) ([]*infrastructure.Area, error)

Types

type Filter

type Filter struct {
	Tag   *TagFilter   `parser:"  @@"`
	Level *LevelFilter `parser:"| @@"`
}

func (*Filter) String

func (f *Filter) String() string

type LevelFilter

type LevelFilter struct {
	Comp string `parser:"'level' @( ('<' '>') | ('<' '=') | ('>' '=') | '=' | '<' | '>' | ('!' '=') )"`
	Numb string `parser:"@Number"`
}

func (*LevelFilter) String

func (l *LevelFilter) String() string

type NodesInArea

type NodesInArea struct {
	AreaId  string    `parser:"(@Ident | @('*'))"`
	Filters []*Filter `parser:"('(' @@ (',' @@)* ')')?"`
}

NodesInArea is a single area.

func (*NodesInArea) String

func (n *NodesInArea) String() string

type Query

type Query struct {
	Set *Set `parser:"@@"`
}

Query is the top-level query structure.

func ParseQuery

func ParseQuery(input string) (*Query, error)

func (*Query) String

func (q *Query) String() string

type Set

type Set struct {
	AreaId      *string      `parser:"  '#'@Ident"`
	NodesInArea *NodesInArea `parser:"| @@"`
	Sets        *Sets        `parser:"| '{' @@ '}'"`
}

Set is a set of areas.

func (*Set) String

func (s *Set) String() string

type SetWithSign

type SetWithSign struct {
	Op  string `parser:"@('+' | '-')"`
	Set *Set   `parser:"@@"`
}

func (*SetWithSign) String

func (s *SetWithSign) String() string

type Sets

type Sets struct {
	InitialSet *Set           `parser:"@@"`
	NextSets   []*SetWithSign `parser:"@@*"`
}

func (*Sets) String

func (g *Sets) String() string

type TagFilter

type TagFilter struct {
	Key   string `parser:"'tag' ':' @Ident '='"`
	Value string `parser:"@Ident"`
}

func (*TagFilter) String

func (t *TagFilter) String() string

Jump to

Keyboard shortcuts

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