Documentation ¶
Index ¶
- Variables
- func ApplyPathRule(path string) string
- func CompressImageByFFmpeg(inputPath, outputPath string, maxEdgeLength uint, quality uint) error
- func CompressImageToJPEG(input []byte, maxSizeMB, maxEdgeLength uint, cacheKey string) ([]byte, error)
- func DownloadWithCache(ctx context.Context, url string, client *req.Client) ([]byte, error)
- func EscapeFileName(fileName string) string
- func EscapeHTML(text string) string
- func EscapeMarkdown(text string) string
- func ExtractTagsFromText(text string) []string
- func FileExists(path string) bool
- func GenerateRandomString(length int, charset ...string) string
- func GetImageBlurScore(b []byte) (float64, error)
- func GetImagePhash(b []byte) (string, error)
- func GetImageSize(b []byte) (int, int, error)
- func GetReqCachedFile(path string) []byte
- func GinBindError(ctx *gin.Context, err error)
- func GinErrorResponse(ctx *gin.Context, err error, status int, message string)
- func Init()
- func MkCache(path string, data []byte, td time.Duration)
- func MkFile(path string, data []byte) error
- func ParseStringTo2DArray(str, sep, sep2 string) [][]string
- func PurgeFile(path string) error
- func PurgeFileAfter(path string, td time.Duration)
- func RemoveEmptyDirectories(dirPath string) error
- func ResizeImage(img image.Image, width, height uint) image.Image
- type RestfulCommonResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Version string = "dev" BuildTime string = "Unknown" Commit string = "Unknown" )
View Source
var Client *req.Client
View Source
var ResendClient *resend.Client
Functions ¶
func ApplyPathRule ¶
func CompressImageByFFmpeg ¶
使用 ffmpeg 压缩图片
func CompressImageToJPEG ¶
func DownloadWithCache ¶
func EscapeFileName ¶
func EscapeHTML ¶
func EscapeMarkdown ¶
func ExtractTagsFromText ¶
func FileExists ¶
func GenerateRandomString ¶
func GetImageBlurScore ¶
func GetImagePhash ¶
func GetReqCachedFile ¶
func GinBindError ¶
func GinErrorResponse ¶
func ParseStringTo2DArray ¶
解析字符串为二维数组, 如果以字符串以引号包裹, 则无视分隔符
ParseStringTo2DArray("1,2,3;4,5,6", ",", ";") => [][]string{{"1", "2", "3"}, {"4", "5", "6"}}
ParseStringTo2DArray("1,2,3;\"4,5,6\"", ",", ";") => [][]string{{"1", "2", "3"}, {"4,5,6"}}
Types ¶
type RestfulCommonResponse ¶
Click to show internal directories.
Click to hide internal directories.