app

package
v0.0.0-...-1746241 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 55 Imported by: 2 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

Index

Constants

View Source
const (
	ContextAdminTeamAccessKey string = "adminTeamAccess"
	ContextAuthRecordKey      string = "authRecord"
	ContextCollectionKey      string = "collection"
	ContextExecStartKey       string = "execStart"
)

Variables

This section is empty.

Functions

func ActivityLogger

func ActivityLogger(app core.App) echo.MiddlewareFunc

func CurrentUserID

func CurrentUserID(c echo.Context) (string, bool)

func CurrentUserIDFromRecordToken

func CurrentUserIDFromRecordToken(app core.App, token string) (string, bool)

func GenerateFileToken

func GenerateFileToken(userID string) (string, error)

func InitRouter

func InitRouter(app core.App, services *Services) (*echo.Echo, error)

func LoadAuthContext

func LoadAuthContext(app core.App) echo.MiddlewareFunc

func LoadCollectionContext

func LoadCollectionContext(app core.App, optCollectionTypes ...string) echo.MiddlewareFunc

func LoadFixedCollectionContext

func LoadFixedCollectionContext(app core.App, collectionName string, collectionType string) echo.MiddlewareFunc

func NewBadRequestError

func NewBadRequestError(message string, data any) error

func NewForbiddenError

func NewForbiddenError(message string, data any) error

func NewNotFoundError

func NewNotFoundError(message string, data any) error

func NewServeCommand

func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command

NewServeCommand creates the HTTP server command.

func NewUnauthorizedError

func NewUnauthorizedError(message string, data any) error

func RegisterCrons

func RegisterCrons(cfg CronConfig) error

func RegisterHooks

func RegisterHooks(cfg HookConfig) error

func RegisterRoutes

func RegisterRoutes(app core.App, router *echo.Echo, api *echo.Group, services *Services)

func RegisterTinybaseDefaults

func RegisterTinybaseDefaults(app core.App, rootCmd *cobra.Command, cfg TinybaseDefaultsConfig)

RegisterTinybaseDefaults wires the default Tinybase CLI flags, commands, updater, query timeout and static file serving into the app.

func RequireAdminTeamAccess

func RequireAdminTeamAccess() echo.MiddlewareFunc

func RequireAdminTeamAccessOrRecordAuth

func RequireAdminTeamAccessOrRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc

func RequireRecordAuth

func RequireRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc

func RunMigrations

func RunMigrations(app core.App) error

func Serve

func Serve(app core.App, config ServeConfig) (*http.Server, error)

Serve starts the application web server through appinit.

func StaticDirectoryHandler

func StaticDirectoryHandler(fileSystem fs.FS, indexFallback bool) echo.HandlerFunc

StaticDirectoryHandler is similar to echo.StaticDirectoryHandler, but without the directory redirect that conflicts with RemoveTrailingSlash middleware. If a file resource is missing and indexFallback is true, index.html is served.

Types

type ApiError

type ApiError struct {
	Code    int            `json:"code"`
	Message string         `json:"message"`
	Data    map[string]any `json:"data"`
}

func NewApiError

func NewApiError(status int, message string, data any) *ApiError

func (*ApiError) Error

func (e *ApiError) Error() string

type CronConfig

type CronConfig struct {
	App             core.App
	CronScheduler   *cronservice.Scheduler
	CronService     *cronservice.CronService
	EnableStatsJobs bool
	EnableLogJobs   bool
}

type HookConfig

type HookConfig struct {
	App            core.App
	EncryptionKey  string
	LoggingService *logsvc.Service
}

type ServeConfig

type ServeConfig struct {
	ShowStartBanner bool
	HttpAddr        string
	HttpsAddr       string

	CertificateDomains []string
	AllowedOrigins     []string

	Services      *Services
	EncryptionKey string
}

type Services

type Services struct {
	Backup        *backupsvc.Service
	CronExecutor  *cronsvc.Executor
	CronScheduler *cronsvc.Scheduler
	Cron          *cronsvc.CronService
	Log           *logsvc.Service
	Mail          *mailsvc.MailService
	Migrate       *migratesvc.Service
	Updater       *updatersvc.Service
}

func NewServices

func NewServices(cfg ServicesConfig) (*Services, error)

type ServicesConfig

type ServicesConfig struct {
	App core.App

	CurrentVersion string

	SearchCollections []string

	MigrateConfig migratesvc.Config
	UpdaterConfig updatersvc.Config
}

type TinybaseDefaultsConfig

type TinybaseDefaultsConfig struct {
	PublicDir       string
	IndexFallback   bool
	QueryTimeoutSec int

	// HideStartBanner disables the default serve command banner.
	HideStartBanner bool
}

TinybaseDefaultsConfig contains optional defaults for the application CLI/runtime wiring.

Jump to

Keyboard shortcuts

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