utils

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyApiStoragePathRule

func ApplyApiStoragePathRule(detail *types.StorageDetail) string

在api返回中重写图片路径, 用于拼接图片直链

例: rule.Type = "alist", rule.Path = "/pictures/", rule.JoinPrefix = "https://example.com/pictures/", rule.TrimPrefix = "/pictures/"

-> https://example.com/pictures/1234567890abcdef.jpg

如果图片路径以rule.Path开头, 且rule.StorageType为空或与图片存储类型匹配, 则将图片路径转换为rule.JoinPrefix + 图片路径去掉rule.TrimPrefix的部分

否则返回原图片路径

func GinBindError

func GinBindError(ctx *gin.Context, err error)

func GinErrorResponse

func GinErrorResponse(ctx *gin.Context, err error, status int, message string)

Types

type RestfulCommonResponse

type RestfulCommonResponse[T any] struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

Jump to

Keyboard shortcuts

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