app

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

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 Dependency struct {
	App        string
	MinVersion string
}

type Installable

type Installable interface {
	OnInstall(ctx context.Context, site any) error
}

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 Module

type Module struct {
	Name  string
	Title string
}

type Uninstallable

type Uninstallable interface {
	OnUninstall(ctx context.Context, site any, dropTables bool) error
}

Uninstallable defines the hook for app uninstallation.

type Upgradable

type Upgradable interface {
	OnUpgrade(ctx context.Context, site any, fromVersion string) error
}

Upgradable defines the hook for app upgrades.

Jump to

Keyboard shortcuts

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