Documentation ¶
Index ¶
- Variables
- func CanUser(ctx context.Context, permission permission.Permission) error
- func MustUseHead(ctx context.Context) types.HeadComponent
- func MustUseLogo(ctx context.Context) templ.Component
- func UseAuthenticated(ctx context.Context) bool
- func UseHead(ctx context.Context) (types.HeadComponent, error)
- func UseIP(ctx context.Context) (string, bool)
- func UseLocale(ctx context.Context, defaultLocale language.Tag) language.Tag
- func UseLocalizedOrFallback(ctx context.Context, key string, fallback string) string
- func UseLocalizer(ctx context.Context) (*i18n.Localizer, bool)
- func UseLogger(ctx context.Context) (*log.Logger, bool)
- func UseLogo(ctx context.Context) (templ.Component, error)
- func UseMeta(ctx context.Context) (map[string]interface{}, bool)
- func UseNavItems(r *http.Request) ([]types.NavigationItem, error)
- func UsePageCtx(r *http.Request, pageData *types.PageData) (*types.PageContext, error)
- func UseRequest(ctx context.Context) (*http.Request, bool)
- func UseSession(ctx context.Context) (*session.Session, error)
- func UseTx(ctx context.Context) (*gorm.DB, bool)
- func UseUniLocalizer(ctx context.Context) (ut.Translator, bool)
- func UseUser(ctx context.Context) (*user.User, error)
- func UseUserAgent(ctx context.Context) (string, bool)
- func UseWriter(ctx context.Context) (http.ResponseWriter, bool)
- func WithParams(ctx context.Context, params *Params) context.Context
- func WithTx(ctx context.Context, tx *gorm.DB) context.Context
- type PaginationParams
- type Params
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoSessionFound = errors.New("no session found") ErrNoUserFound = errors.New("no user found") )
var (
ErrLocalizerNotFound = errors.New("localizer not found")
)
var (
)var (
ErrNoHeadFound = errors.New("no head found")
)
Functions ¶
func CanUser ¶
func CanUser(ctx context.Context, permission permission.Permission) error
func MustUseHead ¶ added in v0.0.2
func MustUseHead(ctx context.Context) types.HeadComponent
MustUseHead returns the head component from the context or panics
func MustUseLogo ¶ added in v0.0.2
MustUseLogo returns the logo component from the context or panics
func UseAuthenticated ¶
UseAuthenticated returns whether the user is authenticated and the second return value is true. If the user is not authenticated, the second return value is false.
func UseHead ¶ added in v0.0.2
func UseHead(ctx context.Context) (types.HeadComponent, error)
UseHead returns the head component from the context
func UseIP ¶
UseIP returns the IP address from the context. If the IP address is not found, the second return value will be false.
func UseLocale ¶
UseLocale returns the locale from the context. If the locale is not found, the second return value will be false.
func UseLocalizedOrFallback ¶
func UseLocalizer ¶
UseLocalizer returns the localizer from the context. If the localizer is not found, the second return value will be false.
func UseLogger ¶
UseLogger returns the logger from the context. If the logger is not found, the second return value will be false.
func UseMeta ¶
UseMeta returns the metadata from the context. If the metadata is not found, the second return value will be false.
func UseNavItems ¶
func UseNavItems(r *http.Request) ([]types.NavigationItem, error)
func UsePageCtx ¶
func UseRequest ¶
UseRequest returns the request from the context. If the request is not found, the second return value will be false.
func UseSession ¶
UseSession returns the session from the context.
func UseTx ¶
UseTx returns the database transaction from the context. If the transaction is not found, the second return value will be false.
func UseUniLocalizer ¶
func UseUniLocalizer(ctx context.Context) (ut.Translator, bool)
func UseUserAgent ¶
UseUserAgent returns the user agent from the context. If the user agent is not found, the second return value will be false.
func UseWriter ¶
func UseWriter(ctx context.Context) (http.ResponseWriter, bool)
UseWriter returns the response writer from the context. If the response writer is not found, the second return value will be false.
func WithParams ¶
WithParams returns a new context with the request parameters.
Types ¶
type PaginationParams ¶
func UsePaginated ¶
func UsePaginated(r *http.Request) PaginationParams