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 (*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.
func (*SafeDBInterface) SQLError ¶ added in v0.10.0
func (db *SafeDBInterface) SQLError() error
SQLError returns the first query a lambda issued that the database layer rejects ($N placeholders, stacked statements). Such a query is a module configuration bug, not a data problem, so callers should fail the request.