grammar

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregation

type Aggregation struct {
	// Function holds the aggregation function used in the aggregation
	Function AggregationFunction `@@`

	// AggregationField holds the field used in the aggregation
	AggregationField string `("(" (@SearchIdentifier)? ")")?`

	// GroupField holds the field used for grouping data
	GroupField string `("by" @SearchIdentifier)?`

	// Comparison holds the comparison operator used in the aggregation
	Comparison *ComparisonOp `(@@`

	// Threshold holds the threshold value used in the aggregation comparison
	Threshold float64 `@ComparisonValue)?`
}

Aggregation represents a struct for grouping and aggregating data

type AggregationFunction

type AggregationFunction struct {
	Count bool `@"count"`
	Min   bool `| @"min"`
	Max   bool `| @"max"`
	Avg   bool `| @"avg"`
	Sum   bool `| @"sum"`
}

AggregationFunction represents the type of aggregation function

type ComparisonOp

type ComparisonOp struct {
	Equal            bool `@"="`
	NotEqual         bool `| @"!="`
	LessThan         bool `| @"<"`
	LessThanEqual    bool `| @"<="`
	GreaterThan      bool `| @">"`
	GreaterThanEqual bool `| @">="`
}

ComparisonOp represents the type of comparison operator used in the aggregation

type Condition

type Condition struct {
	Search      Disjunction  `@@`        // Represents the search condition
	Aggregation *Aggregation `("|" @@)?` // Represents an optional aggregation function and its parameters
}

type Conjunction

type Conjunction struct {
	Nodes []*Term `@@ ("and" @@)*` // Represents a conjunction of terms
}

type Disjunction

type Disjunction struct {
	Nodes []*Conjunction `@@ ("or" @@)*` // Represents a disjunction of conjunctions
}

type OneAllOf

type OneAllOf struct {
	OneOfIdentifier *string `"1 of" @SearchIdentifier`            // Represents a one-of identifier
	AllOfIdentifier *string `| "all of" @SearchIdentifier`        // Represents an all-of identifier
	OneOfPattern    *string `| "1 of" @SearchIdentifierPattern`   // Represents a one-of pattern
	AllOfPattern    *string `| "all of" @SearchIdentifierPattern` // Represents an all-of pattern
	OneOfThem       bool    `| @("1 of them")`                    // Represents the "1 of them" keyword
	ALlOfThem       bool    `| @("all of them")`                  // Represents the "all of them" keyword
}

type Term

type Term struct {
	Negated       *Term        `"not" @@`            // Represents a negation of a term
	OneAllOf      *OneAllOf    `| @@`                // Represents a one-of or all-of pattern
	Identifer     *string      `| @SearchIdentifier` // Represents a search identifier
	Subexpression *Disjunction `| "(" @@ ")"`        // Represents a subexpression
}

Jump to

Keyboard shortcuts

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