events

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package events contains types for events that can be handled by Lua functions. Currently supports HTTP event types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Type() EventType
}

Event is the interface that all event types must implement

type EventType

type EventType string

EventType represents the type of event

const (
	EventTypeHTTP EventType = "http"
)

type ExecutionContext

type ExecutionContext struct {
	// Unique identifier for this execution
	ExecutionID string `json:"execution_id"`

	// Function ID (used for isolating KV and Env data)
	FunctionID string `json:"function_id"`

	// Timestamp when execution started (Unix epoch in seconds)
	StartedAt int64 `json:"started_at"`

	// Request ID from the incoming event (for correlation)
	RequestID string `json:"request_id,omitempty"`

	// Function version
	Version string `json:"version,omitempty"`

	// Function name or identifier
	FunctionName string `json:"function_name,omitempty"`

	// Base URL of the server deployment
	BaseURL string `json:"base_url,omitempty"`
}

ExecutionContext represents the execution context for a function invocation

type HTTPEvent

type HTTPEvent struct {
	Method       string            `json:"method"`
	Path         string            `json:"path"`
	RelativePath string            `json:"relativePath"`
	Headers      map[string]string `json:"headers"`
	Body         string            `json:"body"`
	Query        map[string]string `json:"query"`
}

HTTPEvent represents an incoming HTTP request

func (HTTPEvent) Type

func (h HTTPEvent) Type() EventType

Type returns the event type for HTTPEvent

type HTTPResponse

type HTTPResponse struct {
	StatusCode      int               `json:"statusCode"`
	Headers         map[string]string `json:"headers"`
	Body            string            `json:"body"`
	IsBase64Encoded bool              `json:"isBase64Encoded"`
}

HTTPResponse represents the HTTP response from a Lua function handler

Jump to

Keyboard shortcuts

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