Documentation
¶
Overview ¶
Package app defines the Application and Module system: app.Definition, app.Module, app.Dependency, dependency-DAG resolution, and the Installable/ Upgradable/Uninstallable lifecycle interfaces resolved via Definition.Hooks (the TAD §7 "associated init type").
See TAD §7 and PRD §11 for the full specification. Implemented in Phase 1.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct {
Name string
Title string
Version string
Description string
Publisher string
Modules []Module
Dependencies []Dependency
// Hooks is the Application's lifecycle init type (TAD §7): a value or
// pointer to a type implementing Installable, Upgradable, and/or
// Uninstallable. The Definition struct itself carries no hook methods —
// site.Install(app.Definition)'s signature is fixed by TAD §7.1 step 1 —
// so the optional init type rides inside the Definition and is resolved by
// InstallHook/UpgradeHook/UninstallHook. A nil Hooks (or a type
// implementing none of the interfaces) makes Install/Upgrade/Uninstall
// no-ops beyond the framework's own Document/table registration.
Hooks any
}
func ResolveDAG ¶
func ResolveDAG(apps []Definition) ([]Definition, error)
ResolveDAG topologically sorts the application definitions based on their dependencies. Returns an error if a circular dependency is detected.
func (Definition) InstallHook ¶
func (d Definition) InstallHook() Installable
InstallHook returns the Application's OnInstall hook (PRD §11.3 "Install: register documents, run initial migrations, load fixtures"), or nil when its Hooks type does not implement Installable.
func (Definition) UninstallHook ¶
func (d Definition) UninstallHook() Uninstallable
UninstallHook returns the Application's OnUninstall hook (PRD §11.3 "Uninstall: run teardown hooks, optionally drop tables"), or nil when its Hooks type does not implement Uninstallable.
func (Definition) UpgradeHook ¶
func (d Definition) UpgradeHook() Upgradable
UpgradeHook returns the Application's OnUpgrade hook (PRD §11.3 "Upgrade: run pending migrations, execute upgrade hooks"), or nil when its Hooks type does not implement Upgradable.
type Dependency ¶
type Installable ¶
Installable defines the hook for app installation. Declared with a generic interface to avoid circular dependency at compilation, but can be cast to *orjanda.Site when used in the actual runtime.
type Uninstallable ¶
Uninstallable defines the hook for app uninstallation.