Help us shape the future of Go! Take the 2026 Go Developer Survey

policyengine

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, factory EngineFactory)

Register adds the factory to the built-in opaEngines map.

Types

type Config

type Config struct {
	// Name is the name of the policy engine.
	Name string
	// QueryLanguage is the language of the policy query.
	QueryLanguage string
	// Query is the policy used for query.
	Policy string
}

Config represents the configuration for an OPA policy engine.

type EngineFactory

type EngineFactory interface {
	// Create creates a new engine.
	Create(policy string, queryLanguage string) (PolicyEngine, error)
}

EngineFactory is an interface for creating OPA policy engines.

type PolicyEngine

type PolicyEngine interface {
	// Evaluate evaluates the policy with the given input.
	// input is the verifier reports that engine evaluates against.
	// result indicates whether the input satisfies the policy.
	// err indicates an error happened during the evaluation.
	Evaluate(ctx context.Context, input map[string]interface{}) (result bool, err error)
}

PolicyEngine is an interface that represents a policy engine.

func CreateEngineFromConfig

func CreateEngineFromConfig(engineConfig Config) (PolicyEngine, error)

CreateEngineFromConfig creates an OPA policy engine from the provided configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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