eql

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package eql contains the main API for EQL.

Example EQL query:

GET Person where name = "Marvin"

Index

Constants

View Source
const GroupNodeKind = interpreter.GroupNodeKind

GroupNodeKind is a special node kind representing groups

Variables

This section is empty.

Functions

func ParseQuery

func ParseQuery(name string, query string) (*parser.ASTNode, error)

ParseQuery parses a search query and return its Abstract Syntax Tree.

func RefineQueryByResultRows

func RefineQueryByResultRows(res SearchResult, rows []int) (string, error)

RefineQueryByResultRows tries to construct a query which will only show certain rows of a given query result. Might fail if no primary node per row can be identified or if the "primary" keyword is used.

Types

type SearchResult

type SearchResult interface {

	/*
	   Header returns a data structure describing the result header.
	*/
	Header() SearchResultHeader

	/*
	   Query returns the query which produced this result.
	*/
	Query() string

	/*
	   RowCount returns the number of rows of the result.
	*/
	RowCount() int

	/*
	   Row returns a row of the result.
	*/
	Row(line int) []interface{}

	/*
	   Rows returns all result rows.
	*/
	Rows() [][]interface{}

	/*
	   RowSource returns the sources of a result row.
	   Format is either: <n/e>:<kind>:<key> or q:<query>
	*/
	RowSource(line int) []string

	/*
	   RowSources returns the sources of a result.
	*/
	RowSources() [][]string

	/*
		String returns a string representation of this search result.
	*/
	String() string

	/*
	   CSV returns this search result as comma-separated strings.
	*/
	CSV() string
}

SearchResult models an EQL search result.

func RunQuery

func RunQuery(name string, part string, query string, gm *graph.Manager) (SearchResult, error)

RunQuery runs a search query against a given graph database.

func RunQueryWithNodeInfo

func RunQueryWithNodeInfo(name string, part string, query string, gm *graph.Manager, ni interpreter.NodeInfo) (SearchResult, error)

RunQueryWithNodeInfo runs a search query against a given graph database. Using a given NodeInfo object to retrieve rendering information.

type SearchResultHeader

type SearchResultHeader interface {

	/*
		Partition returns the partition of a search result.
	*/
	Partition() string

	/*
		PrimaryKind returns the primary kind of a search result.
	*/
	PrimaryKind() string

	/*
	   Labels returns all column labels of a search result.
	*/
	Labels() []string

	/*
	   Format returns all column format definitions of a search result.
	*/
	Format() []string

	/*
	   Data returns the data which is displayed in each column of a search result.
	   (e.g. 1:n:name - Name of starting nodes,
	         3:e:key  - Key of edge traversed in the second traversal)
	*/
	Data() []string
}

SearchResultHeader models the header of an EQL search result.

Directories

Path Synopsis
Package interpreter contains the EQL interpreter.
Package interpreter contains the EQL interpreter.
Package parser contains the EQL parser.
Package parser contains the EQL parser.

Jump to

Keyboard shortcuts

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