server

package
v0.0.0-...-ee70bd6 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessionNotFound = errors.New("session not found")

Functions

func DBMigrationsMainDB

func DBMigrationsMainDB(isDevMode bool, metaPath string, migrationsMainFS fs.FS) *sqlx.MainDB

caller has to close db

Types

type Actionable

type Actionable interface {
	Route() string
	Endpoint() string
	FormRoute() string
	IsReadOnly() bool
	UseManualTxManagement() bool
	AllowInSetupSession() bool
	// Handler(httpx.ResponseWriter, *httpx.Request, *ent.Tx) error
	Handler(httpx2.ResponseWriter, *httpx2.Request, ctxx.Context) error
}

type ContextExtender

type ContextExtender interface {
	ExtendContext(input ContextInput) (ctxx.Context, []TxFinalizer, error)
}

type ContextInput

type ContextInput struct {
	ResponseWriter httpx2.ResponseWriter
	Request        *httpx2.Request
	MainTx         *entmain.Tx
	VisitorCtx     *ctxx.VisitorContext
	CurrentCtx     ctxx.Context
	Tenant         *entmain.Tenant
	TenantID       string
	SpaceID        string
	IsReadOnly     bool
}

type ErrorMapper

type ErrorMapper interface {
	HTTPError(err error) (*e.HTTPError, bool)
}

type FormActionable

type FormActionable interface {
	// not always implemented
	//
	// usually you don't want to overwrite the default implementation in util.FormHelper
	// and create a separate form action instead
	FormHandler(httpx2.ResponseWriter, *httpx2.Request, ctxx.Context) error
}

type Router

type Router struct {
	*http.ServeMux
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(
	mainDB *sqlx.MainDB,
	infra *common.Infra,
	i18n *i18n.I18n,
) *Router

func (*Router) Infra

func (qq *Router) Infra() *common.Infra

func (*Router) RegisterAction

func (qq *Router) RegisterAction(
	action Actionable,
)

func (*Router) RegisterActions

func (qq *Router) RegisterActions(actions any)

func (*Router) RegisterCoreRoutes

func (qq *Router) RegisterCoreRoutes(actions *coreaction.Actions)

func (*Router) RegisterPage

func (qq *Router) RegisterPage(pattern string, handlerFn handlerFn)

func (*Router) SetContextExtender

func (qq *Router) SetContextExtender(contextExtender ContextExtender)

func (*Router) SetErrorMapper

func (qq *Router) SetErrorMapper(errorMapper ErrorMapper)

func (*Router) SetTenantHomeRoute

func (qq *Router) SetTenantHomeRoute(tenantHomeRoute func(tenantID string) string)

func (*Router) WrapTx

func (qq *Router) WrapTx(handlerFn handlerFn, isReadOnly bool) http.HandlerFunc

type TxFinalizer

type TxFinalizer interface {
	Commit() error
	Rollback() error
}

Jump to

Keyboard shortcuts

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