common

package
v0.20.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string = "dev"
	BuildTime string = "unknown"
	GitCommit string = "unknown"
)
View Source
var Cache *cache.Cache[any]
View Source
var TagRe = regexp.MustCompile(`(?:^|[\p{Zs}\s.,!?(){}[\]<>\"\',。!?():;、])#([\p{L}\d_]+)`)

Functions

func CacheDelete added in v0.20.0

func CacheDelete(ctx context.Context, key string) error

func CacheGet added in v0.20.0

func CacheGet[T any](ctx context.Context, key string) (T, error)

func CacheSet added in v0.20.0

func CacheSet(ctx context.Context, key string, value any) error

func ExtractTagsFromText added in v0.17.0

func ExtractTagsFromText(text string) []string

func HashString added in v0.11.0

func HashString(s string) string

func Init

func Init()

func InitLogger added in v0.17.0

func InitLogger()

func MkFile

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

创建文件, 自动创建目录

func PurgeFile

func PurgeFile(path string) error

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

func RemoveEmptyDirectories

func RemoveEmptyDirectories(dirPath string) error

递归删除空目录

func RmFileAfter added in v0.3.2

func RmFileAfter(path string, td time.Duration)

Types

This section is empty.

Jump to

Keyboard shortcuts

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