common

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2025 License: AGPL-3.0 Imports: 17 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 TagRe = regexp.MustCompile(`(?:^|[\p{Zs}\s.,!?(){}[\]<>\"\',。!?():;、])#([\p{L}\d_]+)`)

Functions

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

type CommonCache added in v0.4.0

type CommonCache struct {
	// contains filtered or unexported fields
}
var Cache *CommonCache

func (*CommonCache) Delete added in v0.4.0

func (c *CommonCache) Delete(key string) error

func (*CommonCache) Get added in v0.4.0

func (c *CommonCache) Get(key string, value any) error

func (*CommonCache) Set added in v0.4.0

func (c *CommonCache) Set(key string, value any, expireSeconds int) error

Jump to

Keyboard shortcuts

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