Documentation ¶
Index ¶
- Variables
- func BuildTree(nodes []model.Node, id int64) *model.Node
- func CtxData(ctx context.Context) map[string]any
- func CtxDebug(ctx context.Context) bool
- func CtxEditor(ctx context.Context) bool
- func CtxPage(ctx context.Context) *model.Page
- func CtxSEO(ctx context.Context) seo.SEO
- func CtxSite(ctx context.Context) *model.Site
- func CtxURL(ctx context.Context) url.URL
- func Host(r *http.Request) string
- func IsAjax(r *http.Request) bool
- func IsOneOfNotFound(err error) bool
- func IsTLS(r *http.Request) bool
- func IsTextHTML(header http.Header) bool
- func Languages(r *http.Request) []string
- func MediaType(header http.Header) string
- func PageDecorate(w http.ResponseWriter) bool
- func PageNotDecorate(w http.ResponseWriter) bool
- func Scheme(r *http.Request) string
- func SetSkipSelectPage(ctx context.Context) context.Context
- func SetSkipSelectSite(ctx context.Context) context.Context
- func SkipSelectPage(ctx context.Context) bool
- func SkipSelectSite(ctx context.Context) bool
- func WithData(ctx context.Context, data map[string]any) context.Context
- func WithDebug(ctx context.Context, debug bool) context.Context
- func WithEditor(ctx context.Context, isEditor bool) context.Context
- func WithPage(ctx context.Context, m *model.Page) context.Context
- func WithPageDecorate(w http.ResponseWriter, value string)
- func WithSEO(ctx context.Context, s seo.SEO) context.Context
- func WithSite(ctx context.Context, m *model.Site) context.Context
- func WithURL(ctx context.Context, u url.URL) context.Context
- type Cache
- type DefaultMatcher
- type DefaultMenu
- type DefaultPageHandler
- type DefaultSeeder
- func (s *DefaultSeeder) Boot(ctx context.Context) error
- func (s *DefaultSeeder) CreateErrorPages(ctx context.Context, site model.Site) error
- func (s *DefaultSeeder) FindOrCreateLocalhost(ctx context.Context) ([]model.Site, error)
- func (s *DefaultSeeder) InternalCreatePage(ctx context.Context, site model.Site) error
- type DefaultSiteSelector
- func (s *DefaultSiteSelector) HostByLocaleRetrieve(r *http.Request, fallbackLocale string) (*model.Site, string, error)
- func (s *DefaultSiteSelector) HostPathByLocaleRetrieve(r *http.Request, fallbackLocale string) (*model.Site, string, error)
- func (s *DefaultSiteSelector) HostPathRetrieve(r *http.Request, fallbackLocale string) (*model.Site, string, error)
- func (s *DefaultSiteSelector) HostRetrieve(r *http.Request, fallbackLocale string) (*model.Site, string, error)
- func (s *DefaultSiteSelector) Retrieve(r *http.Request) (*model.Site, string, error)
- type ErrorHandler
- type ErrorResolverFunc
- type Matcher
- type Menu
- type PageCreateHandler
- type PageCreateRequest
- type PageHandler
- type RedirectError
- type Renderer
- type Seeder
- type SiteSelector
- type URLVoter
- type Validator
- type Voter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsOneOfNotFound ¶
func IsTextHTML ¶
func PageDecorate ¶
func PageDecorate(w http.ResponseWriter) bool
func PageNotDecorate ¶
func PageNotDecorate(w http.ResponseWriter) bool
func SkipSelectPage ¶
func SkipSelectSite ¶
func WithPageDecorate ¶
func WithPageDecorate(w http.ResponseWriter, value string)
Types ¶
type DefaultMatcher ¶
type DefaultMatcher struct {
// contains filtered or unexported fields
}
func NewDefaultMatcher ¶
func NewDefaultMatcher(voters ...Voter) DefaultMatcher
func (DefaultMatcher) IsAncestor ¶
type DefaultMenu ¶
type DefaultMenu struct {
// contains filtered or unexported fields
}
func NewDefaultMenu ¶
func NewDefaultMenu(menuRepo repository.Menu, nodeRepo repository.Node) *DefaultMenu
type DefaultPageHandler ¶
type DefaultPageHandler struct{}
func NewDefaultPageHandler ¶
func NewDefaultPageHandler() *DefaultPageHandler
func (*DefaultPageHandler) Handle ¶
func (h *DefaultPageHandler) Handle(c echo.Context) error
type DefaultSeeder ¶
type DefaultSeeder struct {
// contains filtered or unexported fields
}
func NewDefaultSeeder ¶
func NewDefaultSeeder(siteRepository repository.Site, pageRepository repository.Page, logger *zap.Logger) *DefaultSeeder
func (*DefaultSeeder) CreateErrorPages ¶
func (*DefaultSeeder) FindOrCreateLocalhost ¶
func (*DefaultSeeder) InternalCreatePage ¶
type DefaultSiteSelector ¶
type DefaultSiteSelector struct {
// contains filtered or unexported fields
}
func NewDefaultSiteSelector ¶
func NewDefaultSiteSelector(cfgRepository repository.Configuration, siteRepository repository.Site) *DefaultSiteSelector
func (*DefaultSiteSelector) HostByLocaleRetrieve ¶
func (*DefaultSiteSelector) HostPathByLocaleRetrieve ¶
func (*DefaultSiteSelector) HostPathRetrieve ¶
func (*DefaultSiteSelector) HostRetrieve ¶
type ErrorHandler ¶
type ErrorHandler struct { Logger *zap.Logger Resolver ErrorResolverFunc SiteSelector SiteSelector PageHandler PageHandler PageRepository repository.Page CfgRepository repository.Configuration }
func NewErrorHandler ¶
func NewErrorHandler( pageHandler PageHandler, resolver ErrorResolverFunc, siteSelector SiteSelector, pageRepository repository.Page, cfgRepository repository.Configuration, logger *zap.Logger, ) *ErrorHandler
func (*ErrorHandler) Handle ¶
func (h *ErrorHandler) Handle(err error, c echo.Context)
type ErrorResolverFunc ¶
func ErrorResolver ¶
func ErrorResolver(asHTTPError func(err error, target **echo.HTTPError)) ErrorResolverFunc
type Matcher ¶
type Matcher interface { // IsCurrent checks whether a node is current IsCurrent(ctx context.Context, node *model.Node) bool // IsAncestor checks whether a node is the ancestor of a current node IsAncestor(ctx context.Context, node *model.Node) bool }
Matcher represents an interface for matching nodes. It provides methods for checking whether a node is current or an ancestor.
type PageCreateHandler ¶
type PageCreateHandler struct {
// contains filtered or unexported fields
}
func NewPageCreateHandler ¶
func NewPageCreateHandler(validator Validator, pageRepo repository.Page) *PageCreateHandler
func (*PageCreateHandler) Handle ¶
func (h *PageCreateHandler) Handle(c echo.Context) error
type PageCreateRequest ¶
type PageCreateRequest struct { SiteID int64 `json:"site_id,omitempty" form:"site_id,omitempty" validate:"required"` URL string `json:"url,omitempty" form:"url,omitempty" validate:"required"` Template string `json:"template,omitempty" form:"template,omitempty" validate:"required"` Title string `json:"title,omitempty" form:"title,omitempty" validate:"max=254"` }
type PageHandler ¶
type PageHandler interface {
Handle(echo.Context) error
}
type RedirectError ¶
func (RedirectError) Error ¶
func (r RedirectError) Error() string
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
func NewRenderer ¶
func NewRenderer(theme theme.Theme, cfgRepo repository.Configuration) *Renderer
type SiteSelector ¶
type Voter ¶
type Voter interface { // MatchNode checks whether a node is current. // // If the voter is not able to determine a result, // it should return nil to let other voters do the job. MatchNode(ctx context.Context, node *model.Node) *bool }
Voter represents an interface for determining whether a node is current.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.