common

package
v0.0.0-...-ccad8da Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *slog.Logger

Functions

func FileExists

func FileExists(path string) bool

func GinBindError

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

func GinErrorResponse

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

func Init

func Init()

func MkCache

func MkCache(path string, data []byte, td time.Duration)

func MkFile

func MkFile(path string, data []byte) error

创建文件, 自动创建目录

func PurgeFile

func PurgeFile(path string) error

删除文件, 并清理空目录. 如果文件不存在则返回 nil

func PurgeFileAfter

func PurgeFileAfter(path string, td time.Duration)

在指定时间后删除和清理文件 (定时器)

func RemoveEmptyDirectories

func RemoveEmptyDirectories(dirPath string) error

递归删除空目录

func RmFileAfter

func RmFileAfter(path string, td time.Duration)

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