Documentation
¶
Overview ¶
Package lua provides the Lua runtime and hot-loading support. CRC: crc-LuaHotLoader.md Spec: deployment.md, module-tracking.md Sequence: seq-lua-hotload.md, seq-unload-module.md
CRC: crc-LuaResolver.md Spec: libraries.md Sequence: seq-lua-resolve.md
CRC: crc-LuaSession.md, crc-LuaRuntime.md (alias), crc-LuaVariable.md, crc-Module.md Spec: interfaces.md, deployment.md, libraries.md, protocol.md, module-tracking.md Sequence: seq-lua-executor-init.md, seq-lua-execute.md, seq-lua-handle-action.md, seq-lua-session-init.md, seq-session-create-backend.md, seq-unload-module.md, seq-require-lua-file.md
LuaSession provides per-session Lua isolation. Each frontend session gets its own LuaSession with a separate Lua VM state. Server owns luaSessions map and creates sessions via callbacks from SessionManager.
Runtime is a type alias for backward compatibility: type Runtime = LuaSession
Package lua provides ViewList wrapper for array value transformation. CRC: crc-ViewList.md, crc-Wrapper.md Spec: viewdefs.md, protocol.md Sequence: seq-viewlist-presenter-sync.md, seq-wrapper-transform.md
Package lua provides ViewListItem type for ViewList array elements. CRC: crc-ViewListItem.md Spec: viewdefs.md Sequence: seq-viewlist-presenter-sync.md, seq-wrapper-transform.md
Package lua provides wrapper support for variable value transformation. CRC: crc-Wrapper.md, crc-Variable.md Spec: protocol.md Sequence: seq-wrapper-transform.md
WrapperRegistry and factory functions for creating wrapper instances. Note: WrapperManager was removed - wrapper functionality is per-session via LuaSession.
Index ¶
- func ComputeTrackingKey(baseDir, absPath string) (string, error)
- func GetType(L *lua.LState, obj any) string
- func LuaToGo(val lua.LValue) interface{}
- func NewViewList(sess *LuaSession, variable *TrackerVariableAdapter) interface{}
- func RegisterCreateFactory(typeName string, factory CreateFactory)
- func RegisterWrapperType(typeName string, factory WrapperFactory)
- type CreateFactory
- type HotLoader
- type ItemWrapperInstance
- type LuaResolver
- func (r *LuaResolver) Call(obj any, methodName string) (any, error)
- func (r *LuaResolver) CallWith(obj any, methodName string, value any) error
- func (r *LuaResolver) ConvertToValueJSON(tracker *changetracker.Tracker, value any) any
- func (r *LuaResolver) CreateValue(variable *changetracker.Variable, typ string, value any) any
- func (r *LuaResolver) CreateWrapper(variable *changetracker.Variable) any
- func (r *LuaResolver) Get(obj any, pathElement any) (any, error)
- func (r *LuaResolver) GetType(variable *changetracker.Variable, obj any) string
- func (r *LuaResolver) Set(obj any, pathElement any, value any) error
- type LuaSession
- func (s *LuaSession) ArrayGet(array any, index int) (any, error)
- func (s *LuaSession) ArrayGetter(array any) (func(int) (any, error), int, error)
- func (s *LuaSession) CreateLuaSession(vendedID string) (*LuaSession, error)
- func (s *LuaSession) GetAppVariableID() int64
- func (s *LuaSession) GetTracker() *changetracker.Tracker
- func (s *LuaSession) Set(varID int64, value any) error
- type LuaWrapper
- type Module
- type PresenterType
- type Runtime
- func (r *Runtime) AfterBatch(vendedID string) []VariableUpdate
- func (r *Runtime) BaseDir() string
- func (r *Runtime) CallLuaWrapperMethod(instance interface{}, method string, args ...interface{}) (interface{}, error)
- func (r *Runtime) CallMethod(instance *lua.LTable, method string, args ...interface{}) (interface{}, error)
- func (r *Runtime) ClearCurrentModule()
- func (r *Runtime) CreateInstance(typeName string, props map[string]interface{}) (*lua.LTable, error)
- func (r *Runtime) CreateItemWrapper(typeName string, viewItem *ViewListItem) (*ItemWrapperInstance, error)
- func (r *Runtime) DestroyLuaSession(vendedID string)
- func (r *Runtime) DirectRequireLuaFile(filename string) (any, error)
- func (r *Runtime) ExecuteInSession(sessionID string, fn func() (interface{}, error)) (interface{}, error)
- func (r *Runtime) GetCurrentModule() *Module
- func (r *Runtime) GetGlobalTable(name string) interface{}
- func (r *Runtime) GetLuaSession(vendedID string) (*LuaSession, bool)
- func (r *Runtime) GetPresenterType(name string) (*PresenterType, bool)
- func (r *Runtime) GetValue(tbl *lua.LTable, key string) interface{}
- func (r *Runtime) HandleFrontendCreate(sessionID string, parentID int64, properties map[string]string) (int64, json.RawMessage, map[string]string, error)
- func (r *Runtime) HandleFrontendUpdate(sessionID string, varID int64, value json.RawMessage) error
- func (r *Runtime) IsFileLoaded(trackingKey string) bool
- func (r *Runtime) ListPresenterTypes() []string
- func (r *Runtime) LoadCode(name, code string) (interface{}, error)
- func (r *Runtime) LoadCodeDirect(name, code string) (interface{}, error)
- func (r *Runtime) LoadFile(filename string) error
- func (r *Runtime) LoadFileAbsolute(path string) error
- func (r *Runtime) Log(level int, format string, args ...interface{})
- func (r *Runtime) NotifyPropertyChange(vendedID string, varID int64, property string, value interface{})
- func (r *Runtime) ProcessMutationQueue()
- func (r *Runtime) RedirectOutput(logPath, errPath string) error
- func (r *Runtime) RemovePrototype(name string, children bool)
- func (r *Runtime) RequireLuaFile(filename string) error
- func (r *Runtime) SetCurrentModule(trackingKey, directory string)
- func (r *Runtime) SetHotLoaderCleanup(cleanup func(path string))
- func (r *Runtime) SetMainLuaCode(code string)
- func (r *Runtime) SetReloading(reloading bool)
- func (r *Runtime) SetValue(tbl *lua.LTable, key string, value interface{})
- func (r *Runtime) SetVariableStore(store VariableStore)
- func (r *Runtime) SetWrapperRegistry(registry *WrapperRegistry)
- func (r *Runtime) Shutdown()
- func (r *Runtime) TriggerBatch()
- func (r *Runtime) UnloadDirectory(dirPath string)
- func (r *Runtime) UnloadModule(moduleName string)
- type TrackerVariableAdapter
- type VariableStore
- type VariableUpdate
- type ViewList
- type ViewListItem
- func (vli *ViewListItem) GetBaseItem() interface{}
- func (vli *ViewListItem) GetIndex() int
- func (vli *ViewListItem) GetItem() interface{}
- func (vli *ViewListItem) GetItemObjID() int64
- func (vli *ViewListItem) GetList() *ViewList
- func (vli *ViewListItem) GetObjID() int64
- func (vli *ViewListItem) SetIndex(index int)
- type WorkItem
- type WorkResult
- type WrapperFactory
- type WrapperRegistry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeTrackingKey ¶ added in v0.11.0
ComputeTrackingKey computes a baseDir-relative tracking key for a file. Symlinks are resolved to get the actual target path. This is a package-level function used by both Runtime and HotLoader. CRC: crc-LuaSession.md
func LuaToGo ¶ added in v0.9.0
LuaToGo converts a Lua value to Go. Fields prefixed with "_" are skipped (internal/private fields).
func NewViewList ¶
func NewViewList(sess *LuaSession, variable *TrackerVariableAdapter) interface{}
NewViewList creates a new ViewList wrapper for a variable.
func RegisterCreateFactory ¶
func RegisterCreateFactory(typeName string, factory CreateFactory)
RegisterCreateFactory registers a Go create factory globally.
func RegisterWrapperType ¶
func RegisterWrapperType(typeName string, factory WrapperFactory)
RegisterWrapperType registers a Go wrapper factory globally.
Types ¶
type CreateFactory ¶
type CreateFactory func(session *LuaSession, value interface{}) interface{}
CreateFactory creates a new object instance from a value.
func GetGlobalCreateFactory ¶
func GetGlobalCreateFactory(typeName string) (CreateFactory, bool)
GetGlobalCreateFactory retrieves a globally registered create factory.
type HotLoader ¶ added in v0.9.0
type HotLoader struct {
// contains filtered or unexported fields
}
HotLoader watches the lua directory for file changes and reloads modified files. CRC: crc-LuaHotLoader.md
func NewHotLoader ¶ added in v0.9.0
func NewHotLoader(cfg *config.Config, luaDir string, getSessions func() []*LuaSession, triggerRefresh func(sessionID string)) (*HotLoader, error)
NewHotLoader creates a new hot loader for the given lua directory. triggerRefresh is called after successful reload to run AfterBatch and push changes to browser.
func (*HotLoader) CleanupDirectory ¶ added in v0.15.0
CleanupDirectory removes tracking state for all files in a directory. Called when a directory is unloaded via session:unloadDirectory(). Seq: seq-unload-module.md
func (*HotLoader) CleanupModule ¶ added in v0.15.0
CleanupModule removes tracking state for a module file. Called when a module is unloaded via session:unloadModule(). Seq: seq-unload-module.md
type ItemWrapperInstance ¶
type ItemWrapperInstance struct {
// contains filtered or unexported fields
}
ItemWrapperInstance represents a created item wrapper (presenter).
type LuaResolver ¶
type LuaResolver struct {
Session *LuaSession
}
LuaResolver implements changetracker.Resolver for Lua tables and Go wrappers. It navigates Lua tables using GetField/RawGetInt and converts values appropriately.
func (*LuaResolver) Call ¶
func (r *LuaResolver) Call(obj any, methodName string) (any, error)
Call invokes a zero-argument method on a Lua table and returns the result. Used for computed getters like compute().
func (*LuaResolver) CallWith ¶
func (r *LuaResolver) CallWith(obj any, methodName string, value any) error
CallWith invokes a one-argument method on a Lua table with the given value. Used for computed setters like setValue(_).
func (*LuaResolver) ConvertToValueJSON ¶ added in v0.9.0
func (r *LuaResolver) ConvertToValueJSON(tracker *changetracker.Tracker, value any) any
ConvertToValueJSON implements the Resolver interface for Lua values. Handles *lua.LTable specially: arrays become []any, objects become ObjectRef.
func (*LuaResolver) CreateValue ¶
func (r *LuaResolver) CreateValue(variable *changetracker.Variable, typ string, value any) any
CreateValue creates a value for the given variable. CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)
func (*LuaResolver) CreateWrapper ¶
func (r *LuaResolver) CreateWrapper(variable *changetracker.Variable) any
CreateWrapper creates a wrapper object for the given variable. The wrapper stands in for the variable's value when child variables navigate paths. Returns the existing wrapper if one exists (for wrapper reuse). CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)
func (*LuaResolver) Get ¶
func (r *LuaResolver) Get(obj any, pathElement any) (any, error)
Get retrieves a value from an object at the given path element.
func (*LuaResolver) GetType ¶
func (r *LuaResolver) GetType(variable *changetracker.Variable, obj any) string
GetType returns a value's type, given the variable as context. CRC: crc-LuaResolver.md Spec: protocol.md (Variable Wrappers section)
type LuaSession ¶
type LuaSession struct {
// Lua VM state and execution
State *lua.LState
// Session identity and state
ID string // Vended session ID (e.g., "1", "2", "3")
McpState *lua.LTable // Logical state root for MCP (defaults to appObject)
McpStateID int64 // Variable ID of mcpState (if tracked)
// contains filtered or unexported fields
}
LuaSession represents a Lua runtime environment for a frontend session. Each session has its own Lua state for complete isolation. ID is the vended session ID (compact integer string like "1", "2") for backend communication.
func NewRuntime ¶
func NewRuntime(cfg *config.Config, luaDir string, vdm *viewdef.ViewdefManager) (*LuaSession, error)
NewRuntime creates a new Lua runtime with executor goroutine. Note: This creates a LuaSession (Runtime is now an alias).
func (*LuaSession) ArrayGetter ¶
func (*LuaSession) CreateLuaSession ¶ added in v0.9.0
func (s *LuaSession) CreateLuaSession(vendedID string) (*LuaSession, error)
CreateLuaSession initializes this LuaSession for a frontend session. vendedID is the compact session ID (e.g., "1", "2") for backend communication. Loads and executes main.lua with a session global. Must be called after SetVariableStore. Returns self after initialization.
func (*LuaSession) GetAppVariableID ¶ added in v0.9.0
func (s *LuaSession) GetAppVariableID() int64
GetAppVariableID returns the app variable ID (variable 1) for this session.
func (*LuaSession) GetTracker ¶
func (s *LuaSession) GetTracker() *changetracker.Tracker
type LuaWrapper ¶
type LuaWrapper struct {
// contains filtered or unexported fields
}
LuaWrapper wraps a Lua table as a Go Wrapper interface.
func NewLuaWrapper ¶
func NewLuaWrapper(session *LuaSession, template luaTable, variable *TrackerVariableAdapter) *LuaWrapper
NewLuaWrapper creates a wrapper from a Lua table definition.
func (*LuaWrapper) Value ¶
func (w *LuaWrapper) Value() any
Value returns the wrapped Lua table instance.
type Module ¶ added in v0.15.0
type Module struct {
// Name is the module's tracking key (baseDir-relative file path)
Name string
// Directory is the directory containing this module
Directory string
// Prototypes tracks prototype names registered by this module
Prototypes []string
// PresenterTypes tracks presenter type names registered by this module
PresenterTypes []string
// Wrappers tracks wrapper names registered by this module
Wrappers []string
}
Module tracks resources registered by a single Lua module file. This enables clean unloading by tracking what each module registered.
func NewModule ¶ added in v0.15.0
NewModule creates a new Module with the given tracking key and directory.
func (*Module) AddPresenterType ¶ added in v0.15.0
AddPresenterType tracks a presenter type registered by this module.
func (*Module) AddPrototype ¶ added in v0.15.0
AddPrototype tracks a prototype registered by this module.
func (*Module) AddWrapper ¶ added in v0.15.0
AddWrapper tracks a wrapper registered by this module.
type PresenterType ¶
PresenterType represents a Lua-defined presenter type.
type Runtime ¶
type Runtime = LuaSession
Runtime is an alias for LuaSession during migration. TODO: Remove after Phase 2 migration is complete.
func (*Runtime) AfterBatch ¶
func (r *Runtime) AfterBatch(vendedID string) []VariableUpdate
AfterBatch triggers change detection for a session after processing a message batch. Returns a list of variable updates that need to be sent to the frontend. vendedID is the compact session ID (e.g., "1", "2").
func (*Runtime) CallLuaWrapperMethod ¶
func (r *Runtime) CallLuaWrapperMethod(instance interface{}, method string, args ...interface{}) (interface{}, error)
CallLuaWrapperMethod invokes a method on a Lua wrapper table via executor. Used by LuaWrapper to call computeValue and destroy methods. The instance can be any interface{} but must be a *lua.LTable at runtime.
func (*Runtime) CallMethod ¶
func (r *Runtime) CallMethod(instance *lua.LTable, method string, args ...interface{}) (interface{}, error)
CallMethod invokes a method on a Lua presenter instance via executor.
func (*Runtime) ClearCurrentModule ¶ added in v0.15.0
func (r *Runtime) ClearCurrentModule()
ClearCurrentModule clears the current module after load completes.
func (*Runtime) CreateInstance ¶
func (r *Runtime) CreateInstance(typeName string, props map[string]interface{}) (*lua.LTable, error)
CreateInstance creates a new instance of a presenter type via executor.
func (*Runtime) CreateItemWrapper ¶
func (r *Runtime) CreateItemWrapper(typeName string, viewItem *ViewListItem) (*ItemWrapperInstance, error)
CreateItemWrapper creates an ItemWrapper instance for a ViewListItem. The ItemWrapper constructor receives the ViewListItem: ItemWrapper(viewListItem). Returns nil if no itemType is specified or the type isn't registered.
func (*Runtime) DestroyLuaSession ¶
DestroyLuaSession cleans up a Lua session. Note: The actual Lua state cleanup is handled by Server calling Shutdown().
func (*Runtime) DirectRequireLuaFile ¶ added in v0.9.0
DirectRequireLuaFile loads a Lua file and tracks it by baseDir-relative path. The filename can be relative to luaDir (e.g., "mcp.lua") or relative to baseDir (e.g., "apps/myapp/init.lua"). Symlinks are resolved to compute the tracking key. CRC: crc-LuaSession.md
func (*Runtime) ExecuteInSession ¶
func (r *Runtime) ExecuteInSession(sessionID string, fn func() (interface{}, error)) (interface{}, error)
ExecuteInSession executes a function within the context of this session. It sets the global 'session' variable to this session's table before execution. Spec: mcp.md CRC: crc-LuaRuntime.md Sequence: seq-mcp-run.md
func (*Runtime) GetCurrentModule ¶ added in v0.15.0
GetCurrentModule returns the module currently being loaded, if any.
func (*Runtime) GetGlobalTable ¶
GetGlobalTable looks up a Lua global by name and returns it if it's a table. Used for auto-discovery of Lua-defined wrappers. Returns nil if the global doesn't exist or isn't a table.
func (*Runtime) GetLuaSession ¶
func (r *Runtime) GetLuaSession(vendedID string) (*LuaSession, bool)
GetLuaSession returns this session if the vendedID matches. With per-session isolation, each LuaSession IS the session.
func (*Runtime) GetPresenterType ¶
func (r *Runtime) GetPresenterType(name string) (*PresenterType, bool)
GetPresenterType returns a registered presenter type.
func (*Runtime) HandleFrontendCreate ¶
func (r *Runtime) HandleFrontendCreate(sessionID string, parentID int64, properties map[string]string) (int64, json.RawMessage, map[string]string, error)
HandleFrontendCreate handles a variable create message from the frontend. For path-based variables, it creates the variable in the tracker and resolves the path. If a wrapper property is set, the tracker automatically creates it via the resolver. Returns the variable ID, resolved value (wrapped if applicable), and properties.
func (*Runtime) HandleFrontendUpdate ¶
HandleFrontendUpdate handles an update to a path-based variable from frontend. Updates the backend object via the variable's path using v.Set(). CRC: crc-LuaRuntime.md Sequence: seq-relay-message.md
func (*Runtime) IsFileLoaded ¶ added in v0.9.0
IsFileLoaded checks if a file has been loaded by this session. The trackingKey should be a baseDir-relative path (e.g., "apps/myapp/app.lua"). Used by hot-loader to skip files not yet loaded. CRC: crc-LuaSession.md
func (*Runtime) ListPresenterTypes ¶
ListPresenterTypes returns all registered presenter type names.
func (*Runtime) LoadCode ¶
LoadCode loads and executes Lua code string via executor. It returns the result of the execution (if any). After execution, processes any queued prototype mutations. Spec: mcp.md, libraries.md CRC: crc-LuaRuntime.md, crc-LuaSession.md
func (*Runtime) LoadCodeDirect ¶ added in v0.9.0
LoadCodeDirect executes Lua code without executor wrapping. Use this when already inside ExecuteInSession to avoid deadlock. After execution, processes any queued prototype mutations. MUST only be called from within an execute() context.
func (*Runtime) LoadFile ¶
LoadFile loads and executes a Lua file via executor (relative to luaDir). Deprecated: Use RequireLuaFile for hot-reload compatible loading.
func (*Runtime) LoadFileAbsolute ¶
LoadFileAbsolute loads and executes a Lua file via executor (absolute path). Deprecated: Use RequireLuaFile for hot-reload compatible loading.
func (*Runtime) NotifyPropertyChange ¶
func (r *Runtime) NotifyPropertyChange(vendedID string, varID int64, property string, value interface{})
NotifyPropertyChange notifies Lua watchers of a property change for a session. Called by external code when a variable property changes. vendedID is the compact session ID (e.g., "1", "2").
func (*Runtime) ProcessMutationQueue ¶ added in v0.9.0
func (r *Runtime) ProcessMutationQueue()
ProcessMutationQueue processes queued prototypes after file load. Called after LoadCode completes. Uses executor for thread safety.
func (*Runtime) RedirectOutput ¶
RedirectOutput redirects Lua's print function and standard streams to log files. It is used by the MCP server in Configured state. Spec: mcp.md CRC: crc-LuaRuntime.md
func (*Runtime) RemovePrototype ¶ added in v0.15.0
RemovePrototype removes a prototype from the registry. If children is true, also removes prototypes whose name starts with "name." (dot-separated children). CRC: crc-LuaSession.md
func (*Runtime) RequireLuaFile ¶ added in v0.9.0
RequireLuaFile loads a Lua file using the unified load tracker. Skips if already loaded (like require()). Returns error if file not found or execution fails. This is the preferred method for hot-reload compatible file loading.
func (*Runtime) SetCurrentModule ¶ added in v0.15.0
SetCurrentModule sets the module being loaded for resource tracking.
func (*Runtime) SetHotLoaderCleanup ¶ added in v0.15.0
SetHotLoaderCleanup sets the callback for cleaning up HotLoader state during unload.
func (*Runtime) SetMainLuaCode ¶
SetMainLuaCode sets the main.lua code to execute for each new session. Used when loading from bundle where filesystem access is not available.
func (*Runtime) SetReloading ¶ added in v0.9.0
SetReloading sets the session.reloading flag. Called by hot-loader before/after reloading files.
func (*Runtime) SetVariableStore ¶
func (r *Runtime) SetVariableStore(store VariableStore)
SetVariableStore sets the variable store for session operations.
func (*Runtime) SetWrapperRegistry ¶
func (r *Runtime) SetWrapperRegistry(registry *WrapperRegistry)
SetWrapperRegistry sets the wrapper registry for registering Lua wrappers.
func (*Runtime) Shutdown ¶
func (r *Runtime) Shutdown()
Shutdown cleans up the Lua VM and stops executor.
func (*Runtime) TriggerBatch ¶
func (r *Runtime) TriggerBatch()
func (*Runtime) UnloadDirectory ¶ added in v0.15.0
UnloadDirectory unloads all modules in a directory and cleans up HotLoader state.
func (*Runtime) UnloadModule ¶ added in v0.15.0
UnloadModule removes all tracking related to a module. This removes prototypes, presenter types, wrappers, and loadedModules entry. It also cleans up HotLoader state via the cleanup callback.
type TrackerVariableAdapter ¶
type TrackerVariableAdapter struct {
*changetracker.Variable
Session *LuaSession
}
TrackerVariableAdapter adapts a change-tracker Variable to WrapperVariable interface
func WrapTrackerVariable ¶
func WrapTrackerVariable(session *LuaSession, v *changetracker.Variable) *TrackerVariableAdapter
type VariableStore ¶
type VariableStore interface {
// Session management - each session has its own tracker
CreateSession(sessionID string, resolver changetracker.Resolver)
DestroySession(sessionID string)
GetTracker(sessionID string) *changetracker.Tracker
// Variable operations (delegate to session's tracker)
CreateVariable(sessionID string, parentID int64, luaObject *lua.LTable, properties map[string]string) (int64, error)
Get(id int64) (value json.RawMessage, properties map[string]string, ok bool)
GetProperty(id int64, name string) (string, bool)
Update(id int64, value json.RawMessage, properties map[string]string) error
Destroy(id int64) error
// Change detection
DetectChanges(sessionID string) bool
GetChanges(sessionID string) []changetracker.Change
}
VariableStore interface for session operations.
type VariableUpdate ¶
type VariableUpdate struct {
VarID int64
Value json.RawMessage
Properties map[string]string
}
VariableUpdate represents a detected change to be sent to the frontend.
type ViewList ¶
type ViewList struct {
Items []*ViewListItem // The actual list of ViewListItem objects
SelectionIndex int // The current selection index
// contains filtered or unexported fields
}
ViewList transforms an array of domain object refs into ViewListItem refs. It creates ViewListItem objects for each item in the source array.
func (*ViewList) SyncViewItems ¶
func (vl *ViewList) SyncViewItems()
SyncViewItems synchronizes the `Items` slice with the `value` slice.
func (*ViewList) Tracker ¶
func (vl *ViewList) Tracker() *changetracker.Tracker
type ViewListItem ¶
type ViewListItem struct {
Item any // BaseItem or a wrapper, if ViewList.itemType is set
BaseItem any // Domain object reference
List *ViewList
Index int
// contains filtered or unexported fields
}
ViewListItem represents an element in a ViewList. It provides domain object access (Item), presenter access (Item), list context (List), and position tracking (Index).
func NewViewListItem ¶
func NewViewListItem(item interface{}, list *ViewList, index int) *ViewListItem
NewViewListItem creates a new ViewListItem for a domain object.
func (*ViewListItem) GetBaseItem ¶
func (vli *ViewListItem) GetBaseItem() interface{}
GetItem returns the (possibly wrapped) item reference.
func (*ViewListItem) GetIndex ¶
func (vli *ViewListItem) GetIndex() int
GetIndex returns the position in the list.
func (*ViewListItem) GetItem ¶
func (vli *ViewListItem) GetItem() interface{}
GetItem returns the (possibly wrapped) item reference.
func (*ViewListItem) GetItemObjID ¶
func (vli *ViewListItem) GetItemObjID() int64
func (*ViewListItem) GetList ¶
func (vli *ViewListItem) GetList() *ViewList
GetList returns the owning ViewList.
func (*ViewListItem) GetObjID ¶
func (vli *ViewListItem) GetObjID() int64
func (*ViewListItem) SetIndex ¶
func (vli *ViewListItem) SetIndex(index int)
SetIndex updates the position (called when list reorders).
type WorkItem ¶
type WorkItem struct {
// contains filtered or unexported fields
}
WorkItem represents a unit of work for the executor.
type WorkResult ¶
type WorkResult struct {
Value interface{}
Err error
}
WorkResult holds the result of a work item.
type WrapperFactory ¶
type WrapperFactory func(session *LuaSession, variable *TrackerVariableAdapter) interface{}
WrapperFactory creates a new wrapper instance for a variable.
func GetGlobalWrapperFactory ¶
func GetGlobalWrapperFactory(typeName string) (WrapperFactory, bool)
GetGlobalWrapperFactory retrieves a globally registered wrapper factory.
type WrapperRegistry ¶
type WrapperRegistry struct {
// contains filtered or unexported fields
}
WrapperRegistry manages registered wrapper types.
func NewWrapperRegistry ¶
func NewWrapperRegistry() *WrapperRegistry
NewWrapperRegistry creates a new wrapper registry.
func (*WrapperRegistry) Get ¶
func (r *WrapperRegistry) Get(typeName string) (WrapperFactory, bool)
Get retrieves a wrapper factory by type name.
func (*WrapperRegistry) Register ¶
func (r *WrapperRegistry) Register(typeName string, factory WrapperFactory)
Register adds a wrapper factory for a type name (instance-specific).
func (*WrapperRegistry) Remove ¶ added in v0.15.0
func (r *WrapperRegistry) Remove(typeName string)
Remove removes a wrapper from the registry.