cutil

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Content managed by Project Forge, see [projectforge.md] for details.

Index

Constants

View Source
const (
	DefaultSearchPath  = "/search"
	DefaultProfilePath = "/profile"
)
View Source
const (
	PageComment = "Thanks for viewing the source; we tried to make it pretty for you"
)

Variables

View Source
var AllowedHeaders = "*"

Functions

func FormatFilename

func FormatFilename(content string, filename string) (string, error)

func FormatJSON

func FormatJSON(v any) (string, error)

func FormatLang

func FormatLang(content string, lang string) (string, error)

func FormatLangIgnoreErrors

func FormatLangIgnoreErrors(content string, lang string) string

func FormatString

func FormatString(content string, l chroma.Lexer) (string, error)

func GetContentType

func GetContentType(rc *fasthttp.RequestCtx) string

func IsContentTypeJSON

func IsContentTypeJSON(c string) bool

func IsContentTypeXML

func IsContentTypeXML(c string) bool

func IsContentTypeYAML

func IsContentTypeYAML(c string) bool

func ParamSetFromRequest

func ParamSetFromRequest(rc *fasthttp.RequestCtx) filter.ParamSet

func ParseForm

func ParseForm(rc *fasthttp.RequestCtx) (util.ValueMap, error)

func ParseFormAsChanges

func ParseFormAsChanges(rc *fasthttp.RequestCtx) (util.ValueMap, error)

func QueryStringBool added in v0.2.5

func QueryStringBool(rc *fasthttp.RequestCtx, key string) bool

func RCRequiredBool added in v0.2.5

func RCRequiredBool(rc *fasthttp.RequestCtx, key string) (bool, error)

func RCRequiredInt added in v0.2.5

func RCRequiredInt(rc *fasthttp.RequestCtx, key string) (int, error)

func RCRequiredString added in v0.2.5

func RCRequiredString(rc *fasthttp.RequestCtx, key string, allowEmpty bool) (string, error)

func RCRequiredUUID added in v0.2.5

func RCRequiredUUID(rc *fasthttp.RequestCtx, key string) (*uuid.UUID, error)

func RequestCtxToMap

func RequestCtxToMap(rc *fasthttp.RequestCtx, data any) util.ValueMap

func RespondDebug

func RespondDebug(rc *fasthttp.RequestCtx, filename string, body any) (string, error)

func RespondJSON

func RespondJSON(rc *fasthttp.RequestCtx, filename string, body any) (string, error)

func RespondMIME

func RespondMIME(filename string, mime string, ext string, ba []byte, rc *fasthttp.RequestCtx) (string, error)

func RespondXML

func RespondXML(rc *fasthttp.RequestCtx, filename string, body any) (string, error)

func RespondYAML

func RespondYAML(rc *fasthttp.RequestCtx, filename string, body any) (string, error)

func WriteCORS

func WriteCORS(rc *fasthttp.RequestCtx)

Types

type Arg

type Arg struct {
	Key         string `json:"key"`
	Title       string `json:"title"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"`
	Default     string `json:"default,omitempty"`
}

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

type Args

type Args []*Arg

type Location

type Location struct {
	URL   string `json:"url"`
	Title string `json:"title"`
	Icon  string `json:"icon,omitempty"`
}

type Locations

type Locations []*Location

type PageState

type PageState struct {
	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"`
	Accounts      user.Accounts     `json:"accounts,omitempty"`
	Authed        bool              `json:"authed,omitempty"`
	Admin         bool              `json:"admin,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"`
	Data          any               `json:"data,omitempty"`
	Logger        util.Logger       `json:"-"`
	Context       context.Context   `json:"-"`
	Span          *telemetry.Span   `json:"-"`
	RenderElapsed float64           `json:"renderElapsed,omitempty"`
}

func LoadPageState added in v0.2.5

func LoadPageState(rc *fasthttp.RequestCtx, key string, logger util.Logger) *PageState

func (*PageState) AddIcon

func (p *PageState) AddIcon(n string)

func (*PageState) Clean added in v0.2.5

func (p *PageState) Clean(as *app.State) error

func (*PageState) Close

func (p *PageState) Close()

func (*PageState) TitleString

func (p *PageState) TitleString() string

func (*PageState) User

func (p *PageState) User() string

type WorkspaceRequest

type WorkspaceRequest struct {
	T        string               `json:"t"`
	K        string               `json:"k"`
	RC       *fasthttp.RequestCtx `json:"-"`
	PS       *PageState           `json:"-"`
	Item     any                  `json:"item,omitempty"`
	Path     []string             `json:"path,omitempty"`
	Project  *project.Project     `json:"-"`
	Sources  source.Sources       `json:"-"`
	Schemata schema.Schemata      `json:"-"`
	Context  context.Context      `json:"-"`
}

func (*WorkspaceRequest) Clone

func (r *WorkspaceRequest) Clone() *WorkspaceRequest

func (*WorkspaceRequest) Route

func (r *WorkspaceRequest) Route(path ...string) string

func (*WorkspaceRequest) RouteAct

func (r *WorkspaceRequest) RouteAct(act *action.Action, drop int, path ...string) string

type XMLResponse

type XMLResponse struct {
	Result any `xml:"result"`
}

Jump to

Keyboard shortcuts

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