Documentation
¶
Index ¶
- Constants
- func ActivityLogger(app core.App) echo.MiddlewareFunc
- func CurrentUserID(c echo.Context) (string, bool)
- func CurrentUserIDFromRecordToken(app core.App, token string) (string, bool)
- func DisallowCanonicalCollectionAccess(collectionName string) echo.MiddlewareFunc
- func EnrichRecord(c echo.Context, app core.App, record *recordmodels.Record, ...) error
- func GenerateFileToken(userID string) (string, error)
- func InitRouter(app core.App, services *Services) (*echo.Echo, error)
- func LoadAuthContext(app core.App) echo.MiddlewareFunc
- func LoadCollectionContext(app core.App, optCollectionTypes ...string) echo.MiddlewareFunc
- func LoadFixedCollectionContext(app core.App, collectionName string, collectionType string) echo.MiddlewareFunc
- func NewBadRequestError(message string, data any) error
- func NewForbiddenError(message string, data any) error
- func NewNotFoundError(message string, data any) error
- func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command
- func NewUnauthorizedError(message string, data any) error
- func RegisterCrons(cfg CronConfig) error
- func RegisterHooks(cfg HookConfig) error
- func RegisterRoutes(app core.App, router *echo.Echo, api *echo.Group, services *Services)
- func RegisterTinybaseDefaults(app core.App, rootCmd *cobra.Command, cfg TinybaseDefaultsConfig)
- func RequestInfo(c echo.Context) *recordmodels.RequestInfo
- func RequireAdminTeamAccess() echo.MiddlewareFunc
- func RequireAdminTeamAccessOrRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc
- func RequireRecordAuth(optCollectionNames ...string) echo.MiddlewareFunc
- func RunMigrations(app core.App) error
- func Serve(app core.App, config ServeConfig) (*http.Server, error)
- func StaticDirectoryHandler(fileSystem fs.FS, indexFallback bool) echo.HandlerFunc
- type ApiError
- type CronConfig
- type HookConfig
- type ServeConfig
- type Services
- type ServicesConfig
- type TinybaseDefaultsConfig
Constants ¶
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 DisallowCanonicalCollectionAccess ¶
func DisallowCanonicalCollectionAccess(collectionName string) echo.MiddlewareFunc
func EnrichRecord ¶
func GenerateFileToken ¶
func InitRouter ¶
InitRouter creates the Echo router and binds service-owned APIs.
func LoadAuthContext ¶
func LoadAuthContext(app core.App) echo.MiddlewareFunc
LoadAuthContext loads auth record context from the Authorization header.
func LoadCollectionContext ¶
func LoadCollectionContext(app core.App, optCollectionTypes ...string) echo.MiddlewareFunc
func NewBadRequestError ¶
func NewForbiddenError ¶
func NewNotFoundError ¶
func NewServeCommand ¶
NewServeCommand creates the HTTP server command.
func NewUnauthorizedError ¶
func RegisterCrons ¶
func RegisterCrons(cfg CronConfig) error
func RegisterHooks ¶
func RegisterHooks(cfg HookConfig) error
func RegisterRoutes ¶
RegisterRoutes binds migrated service APIs.
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 RequestInfo ¶
func RequestInfo(c echo.Context) *recordmodels.RequestInfo
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 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 CronConfig ¶
type CronConfig struct {
App core.App
CronScheduler *cronservice.Scheduler
CronService *cronservice.CronService
EnableStatsJobs bool
EnableLogJobs bool
}
type HookConfig ¶
type ServeConfig ¶
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
}