Documentation
¶
Index ¶
- func AdminApiPrefix() string
- func AdminAssetsPath() string
- func AdminLang(ctx http.Context, key string) string
- func AdminPagePath() string
- func AppUrl() string
- func AuthGuard() string
- func GetAdmin(str string) string
- func GetAdminNil() string
- func GetApi(str string) string
- func GetApiNil() string
- func GetFileUrl() string
- func GetImageUrl() string
- func KebabToCamel(str string) string
- func Map2options(m map[string]string) []map[string]string
- func MatchPath(pattern, requestPath string) bool
- func PascalToCamel(s string) string
- func PascalToSnake(s string) string
- func ReadDir(dir string) []string
- func RequestIs(ctx http.Context, path string) bool
- func RequestMethodIs(ctx http.Context, method string) bool
- func SnakeToPascal(s string) string
- func Url(str string) string
- func UrlNil() string
- func VerifyExport(path string, expires string, signature string) error
- type ExportFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthGuard ¶
func AuthGuard() string
AuthGuard 返回后台使用的 auth guard 名称,默认 admin。
登录、注销与中间件校验必须统一走这个 guard,否则签发的 token 会落到宿主的默认 guard 上,导致带 token 的请求被判为未认证。
func GetAdminNil ¶
func GetAdminNil() string
func Map2options ¶
map2options takes a map[string]string and returns a slice of maps with "label" and "value" keys.
func MatchPath ¶ added in v1.17.1
MatchPath 判断 requestPath 是否命中 pattern。
pattern 支持尾部通配符(如 "/admin-api/system/*")。两侧都会保留前导斜杠, 因为 ctx.Request().Path() 返回的是 "/admin-api/..." 这种完整路径; 之前调用方把 pattern 的前导斜杠 trim 掉了,导致通配符永不命中。
func RequestMethodIs ¶
* * RequestMethodIs 判断请求是否是指定的方法
Types ¶
type ExportFile ¶
type ExportFile struct {
Path string `json:"path"`
Expires string `json:"expires"`
Signature string `json:"signature"`
}
ExportFile 描述一次导出的结果。
前端拿到这三个字段后会直接拼出下载地址,后端在下载时重新校验签名, 避免任意路径读取。
func BuildExport ¶
func BuildExport(disk string, sheetName string, headers []string, rows [][]any) (*ExportFile, error)
BuildExport 把表头与数据行渲染成 xlsx 并返回签名后的下载信息。
Click to show internal directories.
Click to hide internal directories.