# Functions
AllowInvalidUTF8 creates an Option to allow invalid UTF-8 bytes.
ArrayComprehensionTerm creates a new Term with an ArrayComprehension value.
ArrayTerm creates a new Term with an Array value.
BooleanTerm creates a new Term with a Boolean value.
CallTerm returns a new Term with a Call value defined by terms.
CommentsOption returns a parser option to initialize the comments store within the parser.
Compare returns an integer indicating whether two AST values are less than, equal to, or greater than each other.
CompileModules takes a set of Rego modules represented as strings and compiles them for evaluation.
ContainsComprehensions returns true if the Value v contains comprehensions.
ContainsRefs returns true if the Value v contains refs.
Debug creates an Option to set the debug flag to b.
EmptyRef returns a new, empty reference.
Entrypoint creates an Option to set the rule name to use as entrypoint.
FloatNumberTerm creates a new Term with a floating point Number value.
GlobalStore creates an Option to set a key to a certain value in the globalStore.
InitState creates an Option to set a key to a certain value in the global "state" store.
InterfaceToValue converts a native Go value x to a Value.
IntNumberTerm creates a new Term with an integer Number value.
IsComprehension returns true if the supplied value is a comprehension.
IsConstant returns true if the AST value is constant.
IsError returns true if err is an AST error with code.
IsKeyword returns true if s is a language keyword.
IsScalar returns true if the AST value is a scalar.
IsUnknownValueErr returns true if the err is an UnknownValueErr.
IsValidImportPath returns an error indicating if the import path is invalid.
Item is a helper for constructing an tuple containing two Terms representing a key/value pair in an Object.
JSON returns the JSON representation of v.
MaxExpressions creates an Option to stop parsing after the provided number of expressions have been parsed, if the value is 0 then the parser will parse for as many steps as needed (possibly an infinite number).
Memoize creates an Option to set the memoize flag to b.
MustCompileModules compiles a set of Rego modules represented as strings.
MustInterfaceToValue converts a native Go value x to a Value.
MustParseBody returns a parsed body.
MustParseExpr returns a parsed expression.
MustParseImports returns a slice of imports.
MustParseModule returns a parsed module.
MustParsePackage returns a Package.
MustParseRef returns a parsed reference.
MustParseRule returns a parsed rule.
MustParseStatement returns exactly one statement.
MustParseStatements returns a slice of parsed statements.
MustParseTerm returns a parsed term.
NewBody returns a new Body containing the given expressions.
NewBuiltinExpr creates a new Expr object with the supplied terms.
NewComment returns a new Comment object.
NewCompiler returns a new empty compiler.
NewError returns a new Error object.
NewExpr returns a new Expr object.
NewGenericTransformer returns a new GenericTransformer that will transform AST nodes using the function f.
NewGenericVisitor returns a new GenericVisitor that will invoke the function f on AST nodes.
NewGraph returns a new Graph based on modules.
NewHead returns a new Head object.
NewIndexResult returns a new IndexResult object.
NewLocation returns a new Location object.
NewModuleTree returns a new ModuleTreeNode that represents the root of the module tree populated with the given modules.
NewObject creates a new Object with t.
NewQueryContext returns a new QueryContext object.
NewRuleSet returns a new RuleSet containing the given rules.
NewRuleTree returns a new TreeNode that represents the root of the rule tree populated with the given rules.
NewSet returns a new Set containing t.
NewTerm returns a new Term object.
NewTypeEnv returns an empty TypeEnv.
NewValueMap returns a new ValueMap.
NewVarSet returns a new VarSet containing the specified variables.
NewVarVisitor returns a new VarVisitor object.
NullTerm creates a new Term with a Null value.
NumberTerm creates a new Term with a Number value.
ObjectComprehensionTerm creates a new Term with an ObjectComprehension value.
ObjectTerm creates a new Term with an Object value.
Parse parses the data from b using filename as information in the error messages.
ParseBody returns exactly one body.
ParseCompleteDocRuleFromEqExpr returns a rule if the expression can be interpreted as a complete document definition.
ParseExpr returns exactly one expression.
ParseFile parses the file identified by filename.
ParseImports returns a slice of Import objects.
ParseModule returns a parsed Module object.
ParsePackage returns exactly one Package.
ParsePartialObjectDocRuleFromEqExpr returns a rule if the expression can be interpreted as a partial object document definition.
ParsePartialSetDocRuleFromTerm returns a rule if the term can be interpreted as a partial set document definition.
ParseReader parses the data from r using filename as information in the error messages.
ParseRef returns exactly one reference.
ParseRule returns exactly one rule.
ParseRuleFromBody returns a rule if the body can be interpreted as a rule definition.
ParseRuleFromCallEqExpr returns a rule if the term can be interpreted as a function definition (e.g., f(x) = y => f(x) = y { true }).
ParseRuleFromCallExpr returns a rule if the terms can be interpreted as a function returning true or some value (e.g., f(x) => f(x) = true { true }).
ParseRuleFromExpr returns a rule if the expression can be interpreted as a rule definition.
ParseStatement returns exactly one statement.
ParseStatements returns a slice of parsed statements.
ParseTerm returns exactly one term.
Pretty writes a pretty representation of the AST rooted at x to w.
Recover creates an Option to set the recover flag to b.
RefTerm creates a new Term with a Ref value.
RegisterBuiltin adds a new built-in function to the registry.
SetComprehensionTerm creates a new Term with an SetComprehension value.
SetTerm returns a new Term representing a set containing terms t.
Statistics adds a user provided Stats struct to the parser to allow the user to process the results after the parsing has finished.
StringTerm creates a new Term with a String value.
Transform iterates the AST and calls the Transform function on the Transformer t for x before recursing.
TransformComprehensions calls the functio nf on all comprehensions under x.
TransformRefs calls the function f on all references under x.
TransformVars calls the function f on all vars under x.
TypeName returns a human readable name for the AST element type.
Unify returns a set of variables that will be unified when the equality expression defined by terms a and b is evaluated.
ValueToInterface returns the Go representation of an AST value.
VarTerm creates a new Term with a Variable value.
Walk iterates the AST by calling the Visit function on the Visitor v for x before recursing.
WalkBeforeAndAfter iterates the AST by calling the Visit function on the Visitor v for x before recursing.
WalkBodies calls the function f on all bodies under x.
WalkClosures calls the function f on all closures under x.
WalkExprs calls the function f on all expressions under x.
WalkNodes calls the function f on all nodes under x.
WalkRefs calls the function f on all references under x.
WalkRules calls the function f on all rules under x.
WalkTerms calls the function f on all terms under x.
WalkVars calls the function f on all vars under x.
WalkWiths calls the function f on all with modifiers under x.
# Constants
CompileErr indicates an unclassified compile error occurred.
CompileErrorLimitDefault is the default number errors a compiler will allow before exiting.
CompleteDoc represents a document that is completely defined by the rule.
ParseErr indicates an unclassified parse error occurred.
PartialObjectDoc represents an object document that is partially defined by the rule.
PartialSetDoc represents a set document that is partially defined by the rule.
RecursionErr indicates recursion was found during compilation.
TypeErr indicates a type error was caught.
UnsafeVarErr indicates an unsafe variable was found during compilation.
# Variables
Abs returns the number without its sign.
All takes a list and returns true if all of the items are true.
And performs an intersection operation on sets.
Any takes a collection and returns true if any of the items is true.
ArrayConcat returns the result of concatenating two arrays together.
Assign represents the assignment (":=") operator.
Base64Decode deserializes the base64 encoded input string.
Base64Encode serializes the input string into base64 encoding.
Base64UrlDecode deserializes the base64url encoded input string.
Base64UrlEncode serializes the input string into base64url encoding.
BuiltinMap provides a convenient mapping of built-in names to built-in definitions.
Builtins is the registry of built-in functions supported by OPA.
CastArray checks the underlying type of the input.
CastBoolean returns input if it is a boolean; if not returns error.
CastNull returns null if input is null; if not returns error.
CastObject returns the given object if it is null; throws an error otherwise.
CastSet checks the underlying type of the input.
CastString returns input if it is a string; if not returns error.
Clock returns the [hour, minute, second] of the day for the nanoseconds since epoch.
Concat joins an array of strings with an input string.
Contains returns true if the search string is included in the base string.
Count takes a collection or string and counts the number of elements in it.
CryptoX509ParseCertificates returns one or more certificates from the given base64 encoded string containing DER encoded certificates that have been concatenated.
Date returns the [year, month, day] for the nanoseconds since epoch.
DefaultBuiltins is the registry of built-in functions supported in OPA by default.
DefaultRootDocument is the default root document.
DefaultRootRef is a reference to the root of the default document.
Divide divides the first number by the second number.
EndsWith returns true if the search string begins with the base string.
Equal represents the "==" comparison operator.
Equality represents the "=" operator.
FormatInt returns the string representation of the number in the given base after converting it to an integer value.
GlobMatch - not to be confused with regex.globs_match - parses and matches strings against the glob notation.
GlobQuoteMeta returns a string which represents a version of the pattern where all asterisks have been escaped.
GlobsMatch takes two strings regexp-style strings and evaluates to true if their intersection matches a non-empty set of non-empty strings.
GreaterThan represents the ">" comparison operator.
GreaterThanEq represents the ">=" comparison operator.
HTTPSend returns a HTTP response to the given HTTP request.
IgnoreDuringPartialEval is a set of built-in functions that should not be evaluated during partial evaluation.
IndexOf returns the index of a substring contained inside a string.
InputRootDocument names the document containing query arguments.
InputRootRef is a reference to the root of the input document.
Intersection returns the intersection of the given input sets.
IsArray returns true if the input value is an array.
IsBoolean returns true if the input value is a boolean.
IsNull returns true if the input value is null.
IsNumber returns true if the input value is a number.
IsObject returns true if the input value is an object.
IsSet returns true if the input value is a set.
IsString returns true if the input value is a string.
JSONMarshal serializes the input term.
JSONUnmarshal deserializes the input string.
JWTDecode decodes a JSON Web Token and outputs it as an Object.
JWTDecodeVerify verifies a JWT signature under parameterized constraints and decodes the claims if it is valid.
JWTVerifyES256 verifies if a ES256 JWT signature is valid or not.
JWTVerifyHS256 verifies if a HS256 (secret) JWT signature is valid or not.
JWTVerifyPS256 verifies if a PS256 JWT signature is valid or not.
JWTVerifyRS256 verifies if a RS256 JWT signature is valid or not.
Keywords contains strings that map to language keywords.
LessThan represents the "<" comparison operator.
LessThanEq represents the "<=" comparison operator.
Lower returns the input string but with all characters in lower-case.
Max returns the maximum value in a collection.
Min returns the minimum value in a collection.
Minus subtracts the second number from the first number or computes the diff between two sets.
Multiply multiplies two numbers together.
NetCIDROverlap checks if an ip overlaps with cidr and returns true or false.
NotEqual represents the "!=" comparison operator.
NowNanos returns the current time since epoch in nanoseconds.
OPARuntime returns an object containing OPA runtime information such as the configuration that OPA was booted with.
Or performs a union operation on sets.
ParseDurationNanos returns the duration in nanoseconds represented by a duration string.
ParseNanos returns the time in nanoseconds parsed from the string in the given format.
ParseRFC3339Nanos returns the time in nanoseconds parsed from the string in RFC3339 format.
Plus adds two numbers together.
Product takes an array or set of numbers and multiplies them.
RegexFind takes two strings and a number, the pattern, the value and number of match values to return, -1 means all match values.
RegexMatch takes two strings and evaluates to true if the string in the second position matches the pattern in the first position.
RegexSplit splits the input string by the occurences of the given pattern.
RegexTemplateMatch takes two strings and evaluates to true if the string in the second position matches the pattern in the first position.
RegoParseModule parses the input Rego file and returns a JSON representation of the AST.
Rem returns the remainder for x%y for y != 0.
Replace returns the given string with all instances of the second argument replaced by the third.
ReservedVars is the set of names that refer to implicitly ground vars.
RootDocumentNames contains the names of top-level documents that can be referred to in modules and queries.
RootDocumentRefs contains the prefixes of top-level documents that all non-local references start with.
Round rounds the number up to the nearest integer.
SetDiff has been replaced by the minus built-in.
Sort returns a sorted array.
Split returns an array containing elements of the input string split on a delimiter.
Sprintf returns the given string, formatted.
StartsWith returns true if the search string begins with the base string.
Substring returns the portion of a string for a given start index and a length.
Sum takes an array or set of numbers and sums them.
SystemDocumentKey is the name of the top-level key that identifies the system document.
ToNumber takes a string, bool, or number value and converts it to a number.
Trace prints a note that is included in the query explanation.
Trim returns the given string will all leading or trailing instances of the second argument removed.
TypeNameBuiltin returns the type of the input.
Union returns the union of the given input sets.
Upper returns the input string but with all characters in upper-case.
URLQueryDecode decodes a URL encoded input string.
URLQueryEncode encodes the input string into a URL encoded string.
URLQueryEncodeObject encodes the given JSON into a URL encoded query string.
WalkBuiltin generates [path, value] tuples for all nested documents (recursively).
Weekday returns the day of the week (Monday, Tuesday, ...) for the nanoseconds since epoch.
Wildcard represents the wildcard variable as defined in the language.
WildcardPrefix is the special character that all wildcard variables are prefixed with when the statement they are contained in is parsed.
YAMLMarshal serializes the input term.
YAMLUnmarshal deserializes the input string.
# Structs
ArgErrDetail represents a generic argument error.
ArrayComprehension represents an array comprehension as defined in the language.
Builtin represents a built-in function supported by OPA.
No description provided by the author
Compiler contains the state of a compilation process.
Error represents a single error caught during parsing, compiling, etc.
No description provided by the author
GenericTransformer implements the Transformer interface to provide a utility to transform AST nodes using a closure.
GenericVisitor implements the Visitor interface to provide a utility to walk over AST nodes using a closure.
Graph represents the graph of dependencies between rules.
No description provided by the author
No description provided by the author
IndexResult contains the result of an index lookup.
Location records a position in source code.
No description provided by the author
ModuleTreeNode represents a node in the module tree.
Null represents the null value defined by JSON.
ObjectComprehension represents an object comprehension as defined in the language.
No description provided by the author
QueryContext contains contextual information for running an ad-hoc query.
RefErrInvalidDetail describes an undefined reference error where the referenced value does not support the reference operand (e.g., missing object key, invalid key type, etc.).
RefErrUnsupportedDetail describes an undefined reference error where the referenced value does not support dereferencing (e.g., scalars).
No description provided by the author
SetComprehension represents a set comprehension as defined in the language.
Stats stores some statistics, gathered during parsing.
Term is an argument to a function.
TreeNode represents a node in the rule tree.
TypeEnv contains type info for static analysis such as type checking.
UnificationErrDetail describes a type mismatch error when two values are unified (e.g., x = [1,2,y]).
UnknownValueErr indicates a ValueResolver was unable to resolve a reference because the reference refers to an unknown value.
ValueMap represents a key/value map between AST term values.
VarVisitor walks AST nodes under a given node and collects all encountered variables.
VarVisitorParams contains settings for a VarVisitor.
No description provided by the author
# Interfaces
BeforeAndAfterVisitor wraps Visitor to provie hooks for being called before and after the AST has been visited.
Cloner is implemented by any value that has a Clone method, which returns a copy of the value.
ErrorDetails defines the interface for detailed error messages.
No description provided by the author
Object represents an object as defined by the language.
QueryCompiler defines the interface for compiling ad-hoc queries.
Resolver defines the interface for resolving references to native Go values.
RuleIndex defines the interface for rule indices.
Set represents a set as defined by the language.
No description provided by the author
Transformer defines the interface for transforming AST elements.
Value declares the common interface for all Term values.
ValueResolver defines the interface for resolving references to AST values.
Visitor defines the interface for iterating AST elements.
# Type aliases
No description provided by the author
Array represents an array as defined by the language.
No description provided by the author
Boolean represents a boolean value defined by JSON.
Call represents as function call in the language.
DocKind represents the collection of document types that can be produced by rules.
Errors represents a series of errors encountered during parsing, compiling, etc.
ModuleLoader defines the interface that callers can implement to enable lazy loading of modules during compilation.
Number represents a numeric value as defined by JSON.
Option is a function that can set an option on the parser.
QueryCompilerStage defines the interface for stages in the query compiler.
QueryIterator defines the interface for querying AST documents with references.
Ref represents a reference as defined by the language.
RuleSet represents a collection of rules that produce a virtual document.
String represents a string value as defined by JSON.
Var represents a variable as defined by the language.
VarSet represents a set of variables.