rego

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllKeywords added in v0.24.0

func AllKeywords(ctx context.Context, fileName, contents string, module *ast.Module) (map[string][]KeywordUse, error)

AllKeywords returns all keywords in the module.

func BuiltinCategory

func BuiltinCategory(builtin *ast.Builtin) (category string)

func GetBuiltins added in v0.26.0

func GetBuiltins() map[string]*ast.Builtin

func LocationFromPosition added in v0.24.0

func LocationFromPosition(pos types.Position) *ast.Location

func PositionFromLocation

func PositionFromLocation(loc *ast.Location) types.Position

func QueryRegalBundle added in v0.24.0

func QueryRegalBundle(input map[string]any, pq rego.PreparedEvalQuery) (map[string]any, error)

func SetInputContext added in v0.24.0

func SetInputContext(input map[string]any, context map[string]any) map[string]any

func ToInput added in v0.24.0

func ToInput(
	fileURI string,
	cid clients.Identifier,
	content string,
	context map[string]any,
) (map[string]any, error)

ToInput prepares a module with Regal additions to be used as input for evaluation.

func UpdateBuiltins added in v0.26.0

func UpdateBuiltins(caps *ast.Capabilities)

Update updates the builtins database with the provided capabilities.

Types

type BuiltInCall

type BuiltInCall struct {
	Builtin  *ast.Builtin
	Location *ast.Location
	Args     []*ast.Term
}

func AllBuiltinCalls

func AllBuiltinCalls(module *ast.Module) []BuiltInCall

AllBuiltinCalls returns all built-in calls in the module, excluding operators and any other function identified by an infix.

type KeywordUse added in v0.24.0

type KeywordUse struct {
	Name     string             `json:"name"`
	Location KeywordUseLocation `json:"location"`
}

type KeywordUseLocation added in v0.24.0

type KeywordUseLocation struct {
	Row uint `json:"row"`
	Col uint `json:"col"`
}

type RuleHeads added in v0.25.0

type RuleHeads map[string][]*ast.Location

func AllRuleHeadLocations added in v0.25.0

func AllRuleHeadLocations(ctx context.Context, fileName, contents string, module *ast.Module) (RuleHeads, error)

AllRuleHeadLocations returns mapping of rules names to the head locations.

Jump to

Keyboard shortcuts

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