Documentation ¶
Overview ¶
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Package cutil - Content managed by Project Forge, see [projectforge.md] for details.
Index ¶
- Constants
- Variables
- func CleanID(key string, id string) string
- func FormatCleanMarkup(s string, icon string) (string, string, error)
- func FormatFilename(content string, filename string) (string, error)
- func FormatJSON(v any) (string, error)
- func FormatLang(content string, lang string) (string, error)
- func FormatMarkdown(s string) (string, error)
- func FormatString(content string, l chroma.Lexer) (string, error)
- func GetContentType(rc *fasthttp.RequestCtx) string
- func IsContentTypeJSON(c string) bool
- func IsContentTypeXML(c string) bool
- func IsContentTypeYAML(c string) bool
- func ParamSetFromRequest(rc *fasthttp.RequestCtx) filter.ParamSet
- func ParseForm(rc *fasthttp.RequestCtx) (util.ValueMap, error)
- func ParseFormAsChanges(rc *fasthttp.RequestCtx) (util.ValueMap, error)
- func QueryArgsMap(rc *fasthttp.RequestCtx) util.ValueMap
- func QueryStringBool(rc *fasthttp.RequestCtx, key string) bool
- func RCRequiredArray(rc *fasthttp.RequestCtx, key string) ([]string, error)
- func RCRequiredBool(rc *fasthttp.RequestCtx, key string) (bool, error)
- func RCRequiredInt(rc *fasthttp.RequestCtx, key string) (int, error)
- func RCRequiredString(rc *fasthttp.RequestCtx, key string, allowEmpty bool) (string, error)
- func RCRequiredUUID(rc *fasthttp.RequestCtx, key string) (*uuid.UUID, error)
- func RequestCtxToMap(rc *fasthttp.RequestCtx, as *app.State, ps *PageState) util.ValueMap
- func RequestHeadersMap(rc *fasthttp.RequestCtx) map[string]string
- func RespondDebug(rc *fasthttp.RequestCtx, as *app.State, filename string, ps *PageState) (string, error)
- func RespondJSON(rc *fasthttp.RequestCtx, filename string, body any) (string, error)
- func RespondMIME(filename string, mime string, ext string, ba []byte, rc *fasthttp.RequestCtx) (string, error)
- func RespondXML(rc *fasthttp.RequestCtx, filename string, body any) (string, error)
- func RespondYAML(rc *fasthttp.RequestCtx, filename string, body any) (string, error)
- func ResponseHeadersMap(rc *fasthttp.RequestCtx) map[string]string
- func WriteCORS(rc *fasthttp.RequestCtx)
- type Arg
- type ArgResults
- type Args
- type Location
- type Locations
- type PageState
- func (p *PageState) AddIcon(keys ...string)
- func (p *PageState) ClassDecl() string
- func (p *PageState) Clean(_ *fasthttp.RequestCtx, as *app.State) error
- func (p *PageState) Close()
- func (p *PageState) LogError(msg string, args ...any)
- func (p *PageState) TitleString() string
- func (p *PageState) Username() string
- type XMLResponse
Constants ¶
const ( DefaultSearchPath = "/search" DefaultProfilePath = "/profile" )
const (
PageComment = "Thanks for viewing the source; we tried to make it pretty for you"
)
Variables ¶
var ( AllowedRequestHeaders = "*" AllowedResponseHeaders = "*" )
Functions ¶
func FormatCleanMarkup ¶ added in v0.7.6
func FormatJSON ¶
func FormatMarkdown ¶ added in v0.7.5
func GetContentType ¶
func GetContentType(rc *fasthttp.RequestCtx) string
func IsContentTypeJSON ¶
func IsContentTypeXML ¶
func IsContentTypeYAML ¶
func ParamSetFromRequest ¶
func ParamSetFromRequest(rc *fasthttp.RequestCtx) filter.ParamSet
func ParseFormAsChanges ¶
func ParseFormAsChanges(rc *fasthttp.RequestCtx) (util.ValueMap, error)
func QueryArgsMap ¶ added in v0.11.6
func QueryArgsMap(rc *fasthttp.RequestCtx) util.ValueMap
func QueryStringBool ¶ added in v0.2.38
func QueryStringBool(rc *fasthttp.RequestCtx, key string) bool
func RCRequiredArray ¶ added in v0.6.15
func RCRequiredArray(rc *fasthttp.RequestCtx, key string) ([]string, error)
func RCRequiredBool ¶ added in v0.2.38
func RCRequiredBool(rc *fasthttp.RequestCtx, key string) (bool, error)
func RCRequiredInt ¶ added in v0.2.38
func RCRequiredInt(rc *fasthttp.RequestCtx, key string) (int, error)
func RCRequiredString ¶ added in v0.2.38
func RCRequiredUUID ¶ added in v0.2.38
func RequestCtxToMap ¶
func RequestHeadersMap ¶ added in v0.11.6
func RequestHeadersMap(rc *fasthttp.RequestCtx) map[string]string
func RespondDebug ¶
func RespondJSON ¶
func RespondMIME ¶
func RespondXML ¶
func RespondYAML ¶
func ResponseHeadersMap ¶ added in v0.11.6
func ResponseHeadersMap(rc *fasthttp.RequestCtx) map[string]string
func WriteCORS ¶
func WriteCORS(rc *fasthttp.RequestCtx)
Types ¶
type ArgResults ¶
type ArgResults struct { Args Args `json:"args"` Values map[string]string `json:"values"` Missing []string `json:"missing,omitempty"` }
func CollectArgs ¶
func CollectArgs(rc *fasthttp.RequestCtx, args Args) *ArgResults
func (*ArgResults) HasMissing ¶ added in v0.10.8
func (a *ArgResults) HasMissing() bool
type PageState ¶
type PageState struct { Action string `json:"action,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Method string `json:"method,omitempty"` URI *fasthttp.URI `json:"-"` Menu menu.Items `json:"menu,omitempty"` Breadcrumbs cmenu.Breadcrumbs `json:"breadcrumbs,omitempty"` Flashes []string `json:"flashes,omitempty"` Session util.ValueMap `json:"-"` Profile *user.Profile `json:"profile,omitempty"` Authed bool `json:"authed,omitempty"` Admin bool `json:"admin,omitempty"` Params filter.ParamSet `json:"params,omitempty"` Icons []string `json:"icons,omitempty"` RootIcon string `json:"rootIcon,omitempty"` RootPath string `json:"rootPath,omitempty"` RootTitle string `json:"rootTitle,omitempty"` SearchPath string `json:"searchPath,omitempty"` ProfilePath string `json:"profilePath,omitempty"` HideMenu bool `json:"hideMenu,omitempty"` ForceRedirect string `json:"forceRedirect,omitempty"` HeaderContent string `json:"headerContent,omitempty"` Browser string `json:"browser,omitempty"` BrowserVersion string `json:"browserVersion,omitempty"` OS string `json:"os,omitempty"` OSVersion string `json:"osVersion,omitempty"` Platform string `json:"platform,omitempty"` Data any `json:"data,omitempty"` Started time.Time `json:"started,omitempty"` RenderElapsed float64 `json:"renderElapsed,omitempty"` Logger util.Logger `json:"-"` Context context.Context `json:"-"` //nolint:containedctx // properly closed, never directly used Span *telemetry.Span `json:"-"` }
func LoadPageState ¶ added in v0.3.15
func (*PageState) TitleString ¶
type XMLResponse ¶
type XMLResponse struct {
Result any `xml:"result"`
}