Documentation
¶
Overview ¶
Package reactions is the official reader-gesture module: Clap (repeatable applause, capped per reader per post, with a public count) and Read Later (a private, one-per-post mark feeding a personal reading list).
Index ¶
- Constants
- type Module
- func (m *Module) AdminManifest() kernel.AdminExtensionManifest
- func (m *Module) Handler() *api.ReactionHandler
- func (m *Module) Init(_ kernel.Kernel) error
- func (m *Module) Migrations() fs.FS
- func (m *Module) Name() string
- func (m *Module) Optional() []string
- func (m *Module) RegisterPublicRoutes(router chi.Router)
- func (m *Module) RegisterRoutes(router chi.Router)
- func (m *Module) Requires() []string
- func (m *Module) Service() *reactiondomain.Service
- func (m *Module) Shutdown() error
- func (m *Module) Version() string
- type Option
Constants ¶
const ( // Name is the registry key for this module. Name = "reactions" // Version is the module version reported via Module.Version. Version = "0.1.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is the reactions kernel module.
func New ¶
New builds the module, adopting the composition root's wiring. The handler is built once here so routes serve the same instance.
func (*Module) AdminManifest ¶
func (m *Module) AdminManifest() kernel.AdminExtensionManifest
AdminManifest declares this module's admin-shell extensions: the read-later navigation entry.
func (*Module) Handler ¶
func (m *Module) Handler() *api.ReactionHandler
Handler exposes the reaction handler for composition-root wiring.
func (*Module) Init ¶
Init validates presence of the adopted seams. Migration execution is core-driven (it needs the live *sql.DB, which modules never touch directly).
func (*Module) Migrations ¶
Migrations returns the embedded migration filesystem, laid out per driver ({sqlite,postgresql,mysql}/NNN_name.{up,down}.sql). The core runner tracks each module in its own schema_migrations_<module> table.
func (*Module) RegisterPublicRoutes ¶
RegisterPublicRoutes mounts the anonymous reaction surface. Core passes the public router (rate-limited, no auth chain).
func (*Module) RegisterRoutes ¶
RegisterRoutes mounts the authenticated reaction surface. Core passes the protected router (CSRF + JWT + 1MB pre-chained).
func (*Module) Requires ¶
Requires lists hard dependencies. Reactions reference content items and users loosely (owner/content IDs without foreign-key enforcement); users is declared so account deletion cleans up reaction rows in dependency order.
func (*Module) Service ¶
func (m *Module) Service() *reactiondomain.Service
Service exposes the adopted domain service for composition-root wiring. It stays valid for the module's lifetime.
type Option ¶
type Option func(*Module)
Option configures a Module. The composition root supplies every option; direct construction without options yields a standalone module that serves nothing (handlers built over nil dependencies must not be invoked).
func WithContentResolver ¶
func WithContentResolver(resolve api.ContentResolver) Option
WithContentResolver attaches the published-content lookup for slug-scoped handlers. Without one content-scoped endpoints fail at lookup time.
func WithService ¶
func WithService(service *reactiondomain.Service) Option
WithService adopts the reactions domain service (composition root). The same instance backs the browser and public handlers.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for reactions.
|
Package admin owns this module's admin-shell manifest: the declarative UI the single admin SPA renders for reactions. |
|
Package store is the single-source reaction repository: one implementation against *sql.DB plus a kernel Dialect, replacing per-driver copies.
|
Package store is the single-source reaction repository: one implementation against *sql.DB plus a kernel Dialect, replacing per-driver copies. |
|
Package testutil provides the kernel fixture module tests run against.
|
Package testutil provides the kernel fixture module tests run against. |