docs: add doc.go and expand README for V1
Document lifecycle concepts, companion packages, and API reference. Add gitignore for coverage artifacts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Package app orchestrates modular application setup and teardown.
|
||||
//
|
||||
// Register subsystems as [Module] values, attach them to a [Lifecycle], and call
|
||||
// [Lifecycle.Setup] or [Lifecycle.Require] to initialize resources in dependency
|
||||
// order. Always call [Lifecycle.Teardown] (typically via defer) to release
|
||||
// resources in reverse setup order.
|
||||
//
|
||||
// Module authors (dbx, applog, migrate, etc.) and main/cmd packages both import
|
||||
// app. Use [Lifecycle.Context] to propagate the lifecycle through context.Context
|
||||
// for CLI commands via [gitea.auvem.com/go-toolkit/appcli].
|
||||
//
|
||||
// # Concepts
|
||||
//
|
||||
// - [Module] — named unit with optional Setup, Teardown, and Depends
|
||||
// - [Lifecycle] — registry and orchestrator for modules
|
||||
// - Setup order — dependencies first; autoload resolves Depends when enabled
|
||||
// - Require — lazy/conditional setup (common in CLI subcommands)
|
||||
//
|
||||
// # API overview
|
||||
//
|
||||
// Lifecycle — [NewLifecycle], [Lifecycle.Setup], [Lifecycle.Teardown],
|
||||
// [Lifecycle.Require], [Lifecycle.RequireWithOpts], [Lifecycle.GetModule],
|
||||
// [Lifecycle.Context], [LifecycleFromContext]
|
||||
//
|
||||
// Module — [NewModule], [Module.Lifecycle], [Module.Logger], [Module.Loaded]
|
||||
package app
|
||||
Reference in New Issue
Block a user