htt

package
v0.0.0-...-4873089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 26 Imported by: 8

Documentation

Index

Constants

View Source
const ContentTypeJSON = "application/json; charset=utf-8"

ContentTypeJSON ...

View Source
const ContentTypeText = "text/plain; charset=utf-8"

ContentTypeText ...

Variables

This section is empty.

Functions

func ClearCookie

func ClearCookie(w http.ResponseWriter, cookieName string)

ClearCookie ...

func ErrHandled

func ErrHandled(err error, c *gin.Context) bool

ErrHandled 处理 err 错误,并且返回给 c

func FilterAssetNames

func FilterAssetNames(assetNames []string, suffix string) []string

FilterAssetNames ...

func FilterAssetNamesOrdered

func FilterAssetNamesOrdered(assetNames []string, suffix string, orderedNames ...string) []string

FilterAssetNamesOrdered 合并指定后缀名 suffix 的资源,并且通过 orderedNames 指定的顺序先合并,然后再合并 assetNames 中其它的资源。 注意:orderedNames 中不要再包含后缀名

func MergeCSS

func MergeCSS(mustAsset func(name string) []byte, statics []string) string

MergeCSS ...

func MergeJs

func MergeJs(mustAsset func(name string) []byte, statics []string) string

MergeJs ...

func MergeResCSS

func MergeResCSS(mustAsset func(name string) []byte, statics ...string) string

MergeResCSS ...

func MergeResJs

func MergeResJs(mustAsset func(name string) []byte, statics ...string) string

MergeResJs ...

func MinifyCSS

func MinifyCSS(cssString string, devMode bool) string

MinifyCSS ...

func MinifyHTML

func MinifyHTML(htmlString string, devMode bool) string

MinifyHTML ...

func MinifyJs

func MinifyJs(jsString string, devMode bool) string

MinifyJs ...

func MustAuth

func MustAuth(fn http.HandlerFunc, param MustAuthParam, cookieContextKey interface{}) http.HandlerFunc

MustAuth ...

func OpenExplorer

func OpenExplorer(port string)

OpenExplorer ...

func OpenExplorerWithContext

func OpenExplorerWithContext(contextPath, port string)

OpenExplorerWithContext ...

func PprofAddrPflag

func PprofAddrPflag() *string

PprofAddrPflag declares pprof plags.

func PrepareMustAuthFlag

func PrepareMustAuthFlag(param *MustAuthParam)

PrepareMustAuthFlag ...

func ReadCookie

func ReadCookie(r *http.Request, encryptKey, cookieName string, cookieValue CookieValue) error

ReadCookie ...

func ServeFavicon

func ServeFavicon(path string, mustAsset func(name string) []byte,
	assetInfo func(name string) (os.FileInfo, error)) http.HandlerFunc

ServeFavicon ...

func StartPprof

func StartPprof(pprofAddr string)

StartPprof starts pprof.

func WriteCookie

func WriteCookie(w http.ResponseWriter, encryptKey, cookieName string, cookieValue CookieValue) error

WriteCookie ...

func WriteDomainCookie

func WriteDomainCookie(w http.ResponseWriter, domain, encryptKey, cookieName string, cookieValue CookieValue) error

WriteDomainCookie ...

Types

type CookieValue

type CookieValue interface {
	ExpiredTime() time.Time
}

CookieValue ...

type CookieValueImpl

type CookieValueImpl struct {
	UserID    string
	Name      string
	Avatar    string
	CsrfToken string
	Expired   time.Time
}

CookieValueImpl ...

func (*CookieValueImpl) ExpiredTime

func (t *CookieValueImpl) ExpiredTime() time.Time

ExpiredTime ...

type MustAuthParam

type MustAuthParam struct {
	EncryptKey  string
	CookieName  string
	RedirectURI string
	LocalURL    string
	ForceLogin  bool
}

MustAuthParam ...

type RspBase

type RspBase struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

RspBase 代表返回的公共结构

type RspBaseData

type RspBaseData struct {
	Status  int         `json:"status"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

RspBaseData 代表返回的公共结构

Jump to

Keyboard shortcuts

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