cutil

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WebAuthKey  = "auth"
	WebFlashKey = "flash"
	ReferKey    = "refer"
)
View Source
const (
	PageComment = "Thanks for viewing the source; we tried to make it pretty for you"
)

Variables

This section is empty.

Functions

func DecryptMessage

func DecryptMessage(message string, logger *zap.SugaredLogger) (string, error)

func EncryptMessage

func EncryptMessage(message string, logger *zap.SugaredLogger) (string, error)

func FormatFilename

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

func FormatJSON

func FormatJSON(v interface{}) (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 GetFromSession

func GetFromSession(key string, websess util.ValueMap) (string, error)

func IsContentTypeJSON

func IsContentTypeJSON(c string) bool

func IsContentTypeXML

func IsContentTypeXML(c string) bool

func NewCookie

func NewCookie(v string) *fasthttp.Cookie

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 RemoveFromSession

func RemoveFromSession(k string, rc *fasthttp.RequestCtx, websess util.ValueMap, logger *zap.SugaredLogger) error

func RespondDebug added in v0.1.9

func RespondDebug(rc *fasthttp.RequestCtx, filename string, body interface{}) (string, error)

func RespondJSON

func RespondJSON(rc *fasthttp.RequestCtx, filename string, body interface{}) (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 interface{}) (string, error)

func SaveProfile

func SaveProfile(n *user.Profile, rc *fasthttp.RequestCtx, sess util.ValueMap, logger *zap.SugaredLogger) error

func SaveSession

func SaveSession(rc *fasthttp.RequestCtx, websess util.ValueMap, logger *zap.SugaredLogger) error

func StoreInSession

func StoreInSession(k string, v string, rc *fasthttp.RequestCtx, websess util.ValueMap, logger *zap.SugaredLogger) error

func WriteCORS

func WriteCORS(rc *fasthttp.RequestCtx)

Types

type Breadcrumbs []string
func (b Breadcrumbs) Active(i *menu.Item, path []string) (bool, bool)

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   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"`
	ForceRedirect string             `json:"forceRedirect,omitempty"`
	Data          interface{}        `json:"data,omitempty"`
	Logger        *zap.SugaredLogger `json:"-"`
	Context       context.Context    `json:"-"`
	Span          *trace.Span        `json:"-"`
	RenderElapsed float64            `json:"renderElapsed,omitempty"`
}

func (*PageState) AddIcon

func (p *PageState) AddIcon(n string)

func (*PageState) Close

func (p *PageState) Close()

func (*PageState) TitleString

func (p *PageState) TitleString() string

type XMLResponse

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

Jump to

Keyboard shortcuts

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