package
0.0.0-20230915092730-116ca14b7616
Repository: https://github.com/sapcc/arc.git
Documentation: pkg.go.dev

# README

Arc API filter parser

This package contains a parser to transform the filter syntax exposed by the API to a filter expression that can by used by the underlying fact storage system.

As we currently store the facts in a postgresql cloumn of type jsonb the parser currently produces a WHERE clause that uses postgresql specifc json operators.

Example:

fact1 = "1" OR fact2 != 2

is transformed to

( facts->>'fact1' = '1' OR (facts->>'fact2')::numeric <> 2 )

Implementation details

Both the lexer and parser are auto generated. The generated output parser.go and lexer.go are checked into version control, so unless you want to change the parser you don't need to bother with the following.

The lexer is generated using nex from the file filter.nex. It can be installed with go get https://github.com/blynn/nex

The parser is generated using go's yacc implmentation go tool yacc from the file filter.y. It comes with a standard go installation.

The filter.go file contains //go:generate stanzas to generate both the lexer and the parser for you. To modify the parser you just need to edit filter.y or filter.nex and run go generate in the package directory.

# Functions

No description provided by the author
NewLexerWithInit creates a new Lexer object, runs the given callback on it, then returns it.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author