luaengine

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTimeout = 5 * time.Second

DefaultTimeout is the default execution time limit per Lua evaluation.

Variables

View Source
var ErrLuaTimeout = errors.New("lua script exceeded execution time limit")

ErrLuaTimeout is returned when Lua script exceeds execution time limit.

Functions

This section is empty.

Types

type CompiledPolicy

type CompiledPolicy struct {
	// contains filtered or unexported fields
}

CompiledPolicy holds a pre-compiled Lua script for reuse across calls.

func Compile

func Compile(script string) (*CompiledPolicy, error)

Compile parses and compiles a Lua script. The result can be reused for many Evaluate calls.

func (*CompiledPolicy) Evaluate

func (cp *CompiledPolicy) Evaluate(claims map[string]any, tokenType string) error

Evaluate runs the compiled Lua policy against the given claims and token type. It returns nil if the script passes, or an error describing the policy violation.

func (*CompiledPolicy) EvaluateWithTimeout

func (cp *CompiledPolicy) EvaluateWithTimeout(claims map[string]any, tokenType string, timeout time.Duration) error

EvaluateWithTimeout runs with a custom execution timeout.

Jump to

Keyboard shortcuts

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