query

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenAQLFilterStatement

func GenAQLFilterStatement(prms *StatementParameters) (string, error)

GenAQLFilterStatement generates an AQL(arangodb query language) compatible filter query statement.

func GenQualifiedAQLFilterStatement

func GenQualifiedAQLFilterStatement(
	fmap map[string]string,
	filters []*Filter,
) (string, error)

GenQualifiedAQLFilterStatement generates an AQL(arangodb query language) compatible filter query statement where the fields map is expected to contain namespaced(fully qualified like

	{
		tag: "doc.label",
		name: "doc.level.identifier"
	}
)

mapping to database fields.

Types

type Filter

type Filter struct {
	// Field of the object on which the filter will be applied
	Field string
	// Type of filter for matching or exclusion
	Operator string
	// The value to match or exclude
	Value string
	// Logic for combining multiple filter expressions, usually "AND" or "OR"
	Logic string
}

Filter is a container for filter parameters.

func ParseFilterString

func ParseFilterString(fstr string) ([]*Filter, error)

ParseFilterString parses a predefined filter string to Filter structure. The filter string specification is defined in corresponding protocol buffer definition.

type StatementParameters

type StatementParameters struct {
	// Map of filters to database fields
	Fmap map[string]string
	// Slice of Filter structs, contains all necessary items for AQL statement
	Filters []*Filter
	// The variable used for looping inside a collection (i.e. the "s" in "FOR s IN stock")
	Doc string
	// The variable used for looping inside a graph (i.e. the "v" in "FOR v IN 1..1 OUTBOUND s GRAPH 'xyz'")
	Vert string
}

StatementParameters is a container for elements needed in the AQL statement.

Jump to

Keyboard shortcuts

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