handlers

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContentTypeFromFilename

func GetContentTypeFromFilename(filename string) string

func GetPage

func GetPage(ctx *context.Context) int

func Paginate

func Paginate[T any](ctx *context.Context, data []*T, pageInt int, perPage int, templateDataName string, urlPage string, labels int, params *PaginationParams) error

func ParseSearchQueryStr

func ParseSearchQueryStr(query string) (string, map[string]string)

Types

type ContextAuthInfo

type ContextAuthInfo struct {
	Context *context.Context
}

func (ContextAuthInfo) AllowGistsWithoutLogin

func (auth ContextAuthInfo) AllowGistsWithoutLogin() (bool, error)

func (ContextAuthInfo) RequireLogin

func (auth ContextAuthInfo) RequireLogin() (bool, error)

type PaginationParams

type PaginationParams struct {
	Page       int    `schema:"page,omitempty"`
	Sort       string `schema:"sort,omitempty"`
	Order      string `schema:"order,omitempty"`
	Title      string `schema:"title,omitempty"`
	Visibility string `schema:"visibility,omitempty"`
	Language   string `schema:"language,omitempty"`
	Topics     string `schema:"topics,omitempty"`
	Query      string `schema:"q,omitempty"`

	HasPrevious bool `schema:"-"` // Exclude from URL parameters
	HasNext     bool `schema:"-"`
}

func (PaginationParams) NextURL

func (p PaginationParams) NextURL() template.URL

func (PaginationParams) PreviousURL

func (p PaginationParams) PreviousURL() template.URL

func (PaginationParams) String

func (p PaginationParams) String() string

func (PaginationParams) WithParams

func (p PaginationParams) WithParams(pairs ...string) template.URL

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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