lambda

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package lambda provides JavaScript execution capabilities for dynamic modules

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine manages JavaScript lambda execution with security constraints.

func NewEngine

func NewEngine(ctx context.Context) (*Engine, error)

NewEngine creates a new JavaScript execution engine.

func (*Engine) Close

func (e *Engine) Close()

Close properly disposes of the JavaScript runtime.

func (*Engine) ExecuteLambda

func (e *Engine) ExecuteLambda(code string, execCtx ExecutionContext, config LambdaConfig) (string, error)

ExecuteLambda executes a JavaScript lambda function with the given context.

type ExecutionContext

type ExecutionContext struct {
	Item map[string]interface{} `json:"item"`
	DB   *SafeDBInterface       `json:"db"`
}

ExecutionContext provides safe access to data and operations for lambda functions.

type LambdaConfig

type LambdaConfig struct {
	TimeoutMs     int64 `yaml:"timeout_ms" json:"timeout_ms"`
	MemoryLimitMB int64 `yaml:"memory_limit_mb" json:"memory_limit_mb"`
}

LambdaConfig holds configuration for lambda execution.

func DefaultLambdaConfig

func DefaultLambdaConfig() LambdaConfig

DefaultLambdaConfig returns safe default configuration.

type SafeDBInterface

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

SafeDBInterface provides read-only database access for lambda functions.

func NewSafeDBInterface

func NewSafeDBInterface(db database.IDatabase) *SafeDBInterface

NewSafeDBInterface creates a new safe database interface.

func (*SafeDBInterface) Query

func (db *SafeDBInterface) Query(query string, args ...interface{}) (*SafeRows, error)

Query executes a query that returns multiple rows.

func (*SafeDBInterface) QueryRow

func (db *SafeDBInterface) QueryRow(query string, args ...interface{}) (*SafeRow, error)

QueryRow executes a query that returns a single row.

type SafeRow

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

SafeRow provides access to query results.

type SafeRows

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

SafeRows provides access to multiple query results.

Jump to

Keyboard shortcuts

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