application

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectMigrations

func CollectMigrations(app *ApplicationImpl) ([]*migrate.Migration, error)

Types

type Application

type Application interface {
	DB() *gorm.DB
	EventPublisher() event.Publisher
	Modules() []Module
	Controllers() []Controller
	Middleware() []mux.MiddlewareFunc
	Assets() []*embed.FS
	HashFsAssets() []*hashfs.FS
	Templates() []*embed.FS
	LocaleFiles() []*embed.FS
	MigrationDirs() []*embed.FS
	Seed(ctx context.Context) error
	Permissions() []permission.Permission
	RegisterControllers(controllers ...Controller)
	NavigationItems(localizer *i18n.Localizer) []types.NavigationItem
	RegisterModule(module Module)
	RegisterPermissions(permissions ...permission.Permission)
	RegisterHashFsAssets(fs ...*hashfs.FS)
	RegisterAssets(fs ...*embed.FS)
	RegisterTemplates(fs ...*embed.FS)
	RegisterLocaleFiles(fs ...*embed.FS)
	RegisterMigrationDirs(fs ...*embed.FS)
	RegisterService(service interface{})
	RegisterMiddleware(middleware ...mux.MiddlewareFunc)
	Service(service interface{}) interface{}
	Bundle() (*i18n.Bundle, error)
	RunMigrations() error
	RollbackMigrations() error
}

Application with a dynamically extendable service registry

func New

func New(db *gorm.DB, eventPublisher event.Publisher) Application

type ApplicationImpl

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

ApplicationImpl with a dynamically extendable service registry

func (*ApplicationImpl) Assets

func (app *ApplicationImpl) Assets() []*embed.FS

func (*ApplicationImpl) Bundle

func (app *ApplicationImpl) Bundle() (*i18n.Bundle, error)

func (*ApplicationImpl) Controllers

func (app *ApplicationImpl) Controllers() []Controller

func (*ApplicationImpl) DB

func (app *ApplicationImpl) DB() *gorm.DB

func (*ApplicationImpl) EventPublisher

func (app *ApplicationImpl) EventPublisher() event.Publisher

func (*ApplicationImpl) HashFsAssets

func (app *ApplicationImpl) HashFsAssets() []*hashfs.FS

func (*ApplicationImpl) LocaleFiles

func (app *ApplicationImpl) LocaleFiles() []*embed.FS

func (*ApplicationImpl) Middleware

func (app *ApplicationImpl) Middleware() []mux.MiddlewareFunc

func (*ApplicationImpl) MigrationDirs

func (app *ApplicationImpl) MigrationDirs() []*embed.FS

func (*ApplicationImpl) Modules

func (app *ApplicationImpl) Modules() []Module

func (*ApplicationImpl) NavigationItems

func (app *ApplicationImpl) NavigationItems(l *i18n.Localizer) []types.NavigationItem

func (*ApplicationImpl) Permissions

func (app *ApplicationImpl) Permissions() []permission.Permission

func (*ApplicationImpl) RegisterAssets

func (app *ApplicationImpl) RegisterAssets(fs ...*embed.FS)

func (*ApplicationImpl) RegisterControllers

func (app *ApplicationImpl) RegisterControllers(controllers ...Controller)

func (*ApplicationImpl) RegisterHashFsAssets

func (app *ApplicationImpl) RegisterHashFsAssets(fs ...*hashfs.FS)

func (*ApplicationImpl) RegisterLocaleFiles

func (app *ApplicationImpl) RegisterLocaleFiles(fs ...*embed.FS)

func (*ApplicationImpl) RegisterMiddleware

func (app *ApplicationImpl) RegisterMiddleware(middleware ...mux.MiddlewareFunc)

func (*ApplicationImpl) RegisterMigrationDirs

func (app *ApplicationImpl) RegisterMigrationDirs(fs ...*embed.FS)

func (*ApplicationImpl) RegisterModule

func (app *ApplicationImpl) RegisterModule(module Module)

func (*ApplicationImpl) RegisterPermissions

func (app *ApplicationImpl) RegisterPermissions(permissions ...permission.Permission)

func (*ApplicationImpl) RegisterService

func (app *ApplicationImpl) RegisterService(service interface{})

RegisterService registers a new service in the application by its type

func (*ApplicationImpl) RegisterTemplates

func (app *ApplicationImpl) RegisterTemplates(fs ...*embed.FS)

func (*ApplicationImpl) RollbackMigrations

func (app *ApplicationImpl) RollbackMigrations() error

func (*ApplicationImpl) RunMigrations

func (app *ApplicationImpl) RunMigrations() error

func (*ApplicationImpl) Seed

func (app *ApplicationImpl) Seed(ctx context.Context) error

func (*ApplicationImpl) Service

func (app *ApplicationImpl) Service(service interface{}) interface{}

Service retrieves a service by its type

func (*ApplicationImpl) Templates

func (app *ApplicationImpl) Templates() []*embed.FS

type Controller

type Controller interface {
	Register(r *mux.Router)
}

type Module

type Module interface {
	Name() string
	Seed(ctx context.Context, app Application) error
	Register(app Application) error
	NavigationItems(localizer *i18n.Localizer) []types.NavigationItem
}

type SeedFunc

type SeedFunc func(ctx context.Context, app Application) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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