utils

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientIp

func GetClientIp(request *http.Request) string

func GetImages

func GetImages(dir string) ([]string, error)

GetImages 获取目录下的以及所有子目录的所有图片

func GetImagesFromSubDir

func GetImagesFromSubDir(dir string) (map[string][]string, error)

GetImagesFromSubDir 获取目录下的所有子目录名称和图片数组,不包括主目录

func GetLastElement

func GetLastElement(path string) string

GetLastElement 获取目录中最后一个元素

func GetQuery

func GetQuery(r *http.Request) string

GetQuery 获取路由参数的query 例如/random?tag=cat 中的cat

func IsImage

func IsImage(path string) bool

IsImage 检查文件是否是图片

func LoadImage

func LoadImage(path string) (*model.ImageData, error)

LoadImage 从文件加载图片内容

func LowerString

func LowerString(s string) string

LowerString 将字符串改成小写

func Random

func Random(arr []string) string

Random 从数组中随机选择一个元素

func RandomInt

func RandomInt(max int) int

RandomInt 生成一个随机数

Types

This section is empty.

Jump to

Keyboard shortcuts

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