app

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package app wires platforms, routing, middleware, plugins and storage into a runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name   string
	Router *router.Router

	Logger *slog.Logger
	// contains filtered or unexported fields
}

App is the central AstraEngine runtime and registration surface.

func New

func New(name string) *App

New creates an application with an empty router and plugin registry.

func (*App) AppMigrations

func (a *App) AppMigrations(m ...plugin.Migration)

func (*App) AutoPluginMigrationsFromStorage

func (a *App) AutoPluginMigrationsFromStorage()

func (*App) AutoPluginSettingsFromStorage

func (a *App) AutoPluginSettingsFromStorage()

func (*App) Cache

func (a *App) Cache(c cache.Cache)

Cache configures the application cache.

func (*App) CacheStore

func (a *App) CacheStore() cache.Cache

CacheStore returns the configured cache.

func (*App) Callback

func (a *App) Callback(pattern string, h middleware.Handler)

func (*App) Command

func (a *App) Command(name string, h middleware.Handler)

func (*App) CoreMigrations

func (a *App) CoreMigrations(m ...plugin.Migration)

func (*App) Dispatch

func (a *App) Dispatch(ctx context.Context, ev event.Event) error

Dispatch routes a normalized event through its registered platform and handlers.

func (*App) FSM

func (a *App) FSM(manager *fsm.Manager) *fsm.Manager

FSM injects centralized FSM manager middleware for all handlers. If manager is nil, a default in-memory user-scoped manager is created.

func (*App) Fallback

func (a *App) Fallback(h middleware.Handler)

func (*App) Group

func (a *App) Group(m ...middleware.Middleware) *Group

Group creates a route group with shared middleware.

func (*App) Match

func (a *App) Match(re *regexp.Regexp, h middleware.Handler)

func (*App) Message

func (a *App) Message(h middleware.Handler)

func (*App) MigrateDown

func (a *App) MigrateDown(ctx context.Context, steps int) (int, error)

func (*App) MigrateUp

func (a *App) MigrateUp(ctx context.Context) (MigrationReport, error)

func (*App) MigrationPlan

func (a *App) MigrationPlan() []RuntimeMigration

func (*App) MigrationStatus

func (a *App) MigrationStatus(ctx context.Context) ([]MigrationStatus, error)

func (*App) Platform

func (a *App) Platform(p platform.Platform)

Platform registers an adapter by its name.

func (*App) Plugin

func (a *App) Plugin(p plugin.Plugin) error

Plugin registers a compile-time plugin.

func (*App) PluginMigrations

func (a *App) PluginMigrations(store plugin.MigrationStateStore)

func (*App) PluginSettings

func (a *App) PluginSettings(store plugin.SettingsStateStore)

func (*App) Plugins

func (a *App) Plugins() *plugin.Registry

Plugins returns the application plugin registry.

func (*App) RateLimit

func (a *App) RateLimit(rule ratelimit.Rule)

RateLimit adds a centralized rate-limit rule. The first call initializes and injects a shared limiter middleware.

func (*App) Start

func (a *App) Start(ctx context.Context) error

Start initializes plugins and runs all platforms until ctx is canceled.

func (*App) Storage

func (a *App) Storage(store storage.Store)

Storage configures the standard persistent store.

func (*App) Store

func (a *App) Store() storage.Store

Store returns the configured persistent store.

func (*App) Text

func (a *App) Text(text string, h middleware.Handler)

func (*App) Use

func (a *App) Use(m middleware.Middleware)

Use appends global middleware.

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group registers routes with an additional shared middleware chain.

func (*Group) Callback

func (g *Group) Callback(pattern string, h middleware.Handler)

func (*Group) Command

func (g *Group) Command(name string, h middleware.Handler)

func (*Group) Fallback

func (g *Group) Fallback(h middleware.Handler)

func (*Group) Match

func (g *Group) Match(re *regexp.Regexp, h middleware.Handler)

func (*Group) Message

func (g *Group) Message(h middleware.Handler)

func (*Group) Text

func (g *Group) Text(text string, h middleware.Handler)

func (*Group) Use

func (g *Group) Use(m middleware.Middleware)

type MigrationReport

type MigrationReport struct {
	Applied int
	Skipped int
}

type MigrationStatus

type MigrationStatus struct {
	Namespace string
	ID        string
	Name      string
	Applied   bool
	AppliedAt *time.Time
}

type RuntimeMigration

type RuntimeMigration struct {
	Namespace string
	Migration plugin.Migration
}

Jump to

Keyboard shortcuts

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