core

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	*fiber.App
	// contains filtered or unexported fields
}

Application represents the main Mithril application

func New

func New(cfg *Config) *Application

New creates a new Mithril application

func (*Application) AddMiddleware

func (app *Application) AddMiddleware(middleware fiber.Handler)

AddMiddleware adds a middleware to the stack

func (*Application) AutoLoadModules

func (app *Application) AutoLoadModules() error

AutoLoadModules automatically loads modules from the app/modules directory

func (*Application) GetAppConfig

func (app *Application) GetAppConfig() *config.AppConfig

GetAppConfig returns the application configuration

func (*Application) GetCacheConfig

func (app *Application) GetCacheConfig() *config.CacheConfig

GetCacheConfig returns the cache configuration

func (*Application) GetConfig

func (app *Application) GetConfig() *Config

GetConfig returns the application configuration

func (*Application) GetContainer

func (app *Application) GetContainer() *Container

GetContainer returns the dependency injection container

func (*Application) GetCronMonitor

func (app *Application) GetCronMonitor() *monitoring.CronMonitor

GetCronMonitor returns the cron monitor

func (*Application) GetDatabaseConfig

func (app *Application) GetDatabaseConfig() *config.DatabaseConfig

GetDatabaseConfig returns the database configuration

func (*Application) GetMiddlewareStack

func (app *Application) GetMiddlewareStack() *middleware.MiddlewareStack

GetMiddlewareStack returns the middleware stack

func (*Application) GetModuleManager

func (app *Application) GetModuleManager() *ModuleManager

GetModuleManager returns the module manager

func (*Application) GetQueueMonitor

func (app *Application) GetQueueMonitor() *monitoring.QueueMonitor

GetQueueMonitor returns the queue monitor

func (*Application) GetSwagger

func (app *Application) GetSwagger() *swagger.SwaggerMiddleware

GetSwagger returns the Swagger middleware

func (*Application) GetSystemMonitor

func (app *Application) GetSystemMonitor() *monitoring.SystemMonitor

GetSystemMonitor returns the system monitor

func (*Application) GetValidator

func (app *Application) GetValidator() *validation.Validator

GetValidator returns the validation instance

func (*Application) RegisterModule

func (app *Application) RegisterModule(module Module) error

RegisterModule registers a module

func (*Application) RegisterRoute

func (app *Application) RegisterRoute(method, path string, decorators ...swagger.RouteDecorator)

RegisterRoute registers a route with Swagger documentation

func (*Application) SetMiddlewareStack

func (app *Application) SetMiddlewareStack(stack *middleware.MiddlewareStack)

SetMiddlewareStack sets a custom middleware stack

func (*Application) Start

func (app *Application) Start() error

Start starts the application server

func (*Application) UseMiddleware

func (app *Application) UseMiddleware(middleware fiber.Handler)

UseMiddleware applies a middleware to the app

type Config

type Config struct {
	Name        string
	Version     string
	Environment string
	Debug       bool
	Port        string
	Host        string
}

Config holds the application configuration

type Container

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

Container is a simple dependency injection container

func NewContainer

func NewContainer() *Container

NewContainer creates a new container

func (*Container) AutoWire

func (c *Container) AutoWire(target interface{}) error

AutoWire attempts to automatically wire dependencies based on struct tags

func (*Container) Bind

func (c *Container) Bind(name string, service interface{})

Bind registers a service in the container

func (*Container) Clear

func (c *Container) Clear()

Clear removes all services from the container

func (*Container) Has

func (c *Container) Has(name string) bool

Has checks if a service is registered

func (*Container) MustResolve

func (c *Container) MustResolve(name string) interface{}

MustResolve retrieves a service from the container and panics if not found

func (*Container) Resolve

func (c *Container) Resolve(name string) (interface{}, error)

Resolve retrieves a service from the container

func (*Container) Singleton

func (c *Container) Singleton(name string, factory func() interface{})

Singleton registers a service as a singleton

type Module

type Module interface {
	RegisterRoutes()
	GetName() string
}

Module represents a Mithril module

type ModuleManager

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

ModuleManager manages all registered modules

func NewModuleManager

func NewModuleManager(app *Application) *ModuleManager

NewModuleManager creates a new module manager

func (*ModuleManager) AutoLoadModules

func (mm *ModuleManager) AutoLoadModules() error

AutoLoadModules automatically loads modules from the app/modules directory

func (*ModuleManager) GetModule

func (mm *ModuleManager) GetModule(name string) (Module, bool)

GetModule returns a registered module by name

func (*ModuleManager) ListModules

func (mm *ModuleManager) ListModules() map[string]Module

ListModules returns all registered modules

func (*ModuleManager) RegisterModule

func (mm *ModuleManager) RegisterModule(module Module) error

RegisterModule registers a module

type ModuleRegistry

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

ModuleRegistry provides a simple way to register modules

func NewModuleRegistry

func NewModuleRegistry(manager *ModuleManager) *ModuleRegistry

NewModuleRegistry creates a new module registry

func (*ModuleRegistry) Register

func (mr *ModuleRegistry) Register(module Module) error

Register registers a module

func (*ModuleRegistry) RegisterAll

func (mr *ModuleRegistry) RegisterAll(modules ...Module) error

RegisterAll registers multiple modules

type PlaceholderModule

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

PlaceholderModule is a placeholder for dynamically loaded modules

func (*PlaceholderModule) GetName

func (pm *PlaceholderModule) GetName() string

GetName returns the module name

func (*PlaceholderModule) RegisterRoutes

func (pm *PlaceholderModule) RegisterRoutes()

RegisterRoutes registers routes for the placeholder module

Jump to

Keyboard shortcuts

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