app

package
v0.0.0-...-edeb3c3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	RootCmd *cobra.Command
	// contains filtered or unexported fields
}

func New

func New(sets models.Config) *App

func (*App) Bootstrap

func (a *App) Bootstrap() error

Bootstrap initializes the application, including - database - store (a in memory key-value store) - logger - settings - built-in template registry We do not load user defined templates here; also no routes or middleware as the server is seperately initialized.

func (*App) DB

func (app *App) DB() *db.DB

func (*App) DataDir

func (app *App) DataDir() string

func (*App) InitDataDB

func (app *App) InitDataDB(dir string, file string, maxopenconns int, maxidleconns int) error

func (*App) InitDataStoreManager

func (a *App) InitDataStoreManager(db *db.DB, tablename string, idfield string) error

func (*App) InitDefaultTemplateRegistry

func (a *App) InitDefaultTemplateRegistry() error

func (*App) InitLogger

func (app *App) InitLogger() error

INFO: every init function must make sure of it's own dependencies

func (*App) InitSessions

func (a *App) InitSessions(db *db.DB, stn, utn, idfield string, lsessexp, ssessexp int, sets *models.Settings) error

func (*App) InitSettings

func (a *App) InitSettings(dsm *datastore.DataStoreManager, key string) error

func (*App) InitTokens

func (a *App) InitTokens(db *db.DB, atn, utn, idfield string, lressexp, sressexp int) error

func (*App) InitUserTemplateRegistry

func (a *App) InitUserTemplateRegistry(fs fs.FS, opt templates.RegistryOptions) error

func (*App) InitUsers

func (a *App) InitUsers(db *db.DB, utn, idfield string, uexp int, sets *models.Settings) error

func (*App) IsBootstrapped

func (a *App) IsBootstrapped() bool

func (*App) IsDev

func (app *App) IsDev() bool

IsDev returns true if the application is running in development mode.

func (*App) Logger

func (app *App) Logger() *slog.Logger

Logger returns the default app logger.

If the application is not bootstrapped yet, fallbacks to slog.Default().

func (*App) RefreshSetupState

func (a *App) RefreshSetupState() int

func (*App) Registry

func (a *App) Registry() *templates.Registry

func (*App) ResetBootstrapState

func (a *App) ResetBootstrapState() error

func (*App) Sessions

func (app *App) Sessions() *sessions.SessionManager

func (*App) Settings

func (a *App) Settings() *models.Settings

func (*App) SetupState

func (a *App) SetupState() int

func (*App) SystemRegistry

func (a *App) SystemRegistry() *templates.Registry

func (*App) Terminate

func (a *App) Terminate() error

func (*App) Users

func (app *App) Users() *users.UserManager

Jump to

Keyboard shortcuts

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