Documentation
¶
Overview ¶
Package example provides a minimal example of implementing the AppBackend interface. This demonstrates how to create an app that can run in both multi-app and single-app modes.
Index ¶
- type ExampleApp
- func (a *ExampleApp) EntSchemas() []ent.Schema
- func (a *ExampleApp) Migrations() []multiapp.Migration
- func (a *ExampleApp) Name() string
- func (a *ExampleApp) OnRegister(ctx context.Context, cfg *multiapp.AppConfig) error
- func (a *ExampleApp) OnShutdown(ctx context.Context) error
- func (a *ExampleApp) Routes(deps multiapp.Dependencies) chi.Router
- func (a *ExampleApp) Slug() string
- type Item
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExampleApp ¶
type ExampleApp struct {
// contains filtered or unexported fields
}
ExampleApp is a minimal implementation of the AppBackend interface. It demonstrates the core patterns for building multi-app compatible backends.
func (*ExampleApp) EntSchemas ¶
func (a *ExampleApp) EntSchemas() []ent.Schema
EntSchemas returns Ent schemas for this app. This example uses raw SQL migrations instead of Ent schemas.
func (*ExampleApp) Migrations ¶
func (a *ExampleApp) Migrations() []multiapp.Migration
Migrations returns database migrations for this app. Each migration runs in the app's schema (e.g., app_example).
func (*ExampleApp) OnRegister ¶
OnRegister is called when the app is registered with the server. Use this for one-time initialization that requires the app config.
func (*ExampleApp) OnShutdown ¶
func (a *ExampleApp) OnShutdown(ctx context.Context) error
OnShutdown is called during graceful shutdown. Use this to clean up resources.
func (*ExampleApp) Routes ¶
func (a *ExampleApp) Routes(deps multiapp.Dependencies) chi.Router
Routes returns the app's HTTP routes. These routes will be mounted at / in single-app mode, or dispatched via X-App-ID in multi-app mode.
func (*ExampleApp) Slug ¶
func (a *ExampleApp) Slug() string
Slug returns the app's unique identifier.