Documentation
¶
Index ¶
- Variables
- func DownloadWithCache(ctx context.Context, url string, client *req.Client) ([]byte, error)
- 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 GetBodyReader(ctx context.Context, url string, client *req.Client) (io.ReadCloser, error)
- func GetReqCachedFile(url string) ([]byte, error)
- func Init()
- func MD5Hash(data string) string
- 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 RmFileAfter(path string, td time.Duration)
- func SanitizeFileName(fileName string) string
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 Logger *slog.Logger
View Source
var MeilisearchClient meilisearch.ServiceManager
View Source
var ResendClient *resend.Client
View Source
var TagRe = regexp.MustCompile(`(?:^|[\p{Zs}\s.,!?(){}[\]<>\"\',。!?():;、])#([\p{L}\d_]+)`)
View Source
var TaggerClient *taggerClient
Functions ¶
func DownloadWithCache ¶
func EscapeHTML ¶
func EscapeMarkdown ¶
func ExtractTagsFromText ¶
func FileExists ¶
func GenerateRandomString ¶
func GetBodyReader ¶ added in v0.60.0
func GetReqCachedFile ¶
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"}}
func RmFileAfter ¶ added in v0.60.0
func SanitizeFileName ¶ added in v0.86.0
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.