Moonshark/core/workers/context.go
2025-03-06 06:23:17 -06:00

25 lines
558 B
Go

package workers
// Context represents execution context for a Lua script
type Context struct {
// Generic map for any context values (route params, HTTP request info, etc.)
Values map[string]any
}
// NewContext creates a new context with initialized maps
func NewContext() *Context {
return &Context{
Values: make(map[string]any),
}
}
// Set adds a value to the context
func (c *Context) Set(key string, value any) {
c.Values[key] = value
}
// Get retrieves a value from the context
func (c *Context) Get(key string) any {
return c.Values[key]
}