util

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 13 Imported by: 0

README

README.md

package util

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile

func CopyFile(source string, dest string) (bool, error)

CopyFile copy()

func FileExists

func FileExists(filename string) bool

FileExists : Checks whether a file or directory exists 如果由 filename 指定的文件或目录 存在则返回 true,否则返回 false

func FileExt

func FileExt(filename string) string

func FileMTime

func FileMTime(filename string) (int64, error)

FileMTime filemtime(): Gets file modification time

func FileSize

func FileSize(filename string) (int64, error)

FileSize filesize(): Gets file size

func HumanTime

func HumanTime(timestamp int64) string

HumanTime 获取可读性友好的时间字符串

func IsAvailable

func IsAvailable(name string, data interface{}) bool

IsAvailable isset()

func IsDir

func IsDir(filename string) bool

IsDir : Tells whether the filename is a directory 判断给定文件名是否是一个目录: 是目录返回true

func IsFile

func IsFile(filename string) bool

IsFile : Tells whether the filename is a regular file 判断给定文件名是否为一个文件: 是文件返回true

func IsReadable

func IsReadable(filename string) bool

IsReadable is_readable()

func IsWriteable

func IsWriteable(filename string) bool

IsWriteable is_writeable()

func PasswordHash

func PasswordHash(password string) (string, error)

PasswordHash Creates a password hash 密码加密: 同PHP函数 password_hash()

func PasswordVerify

func PasswordVerify(password, hash string) bool

PasswordVerify : Verifies that a password matches a hash 加密密码验证: 同PHP函数 password_verify()

func PureHtmlContent

func PureHtmlContent(html string) (content string)

PureHtmlContent 获取 HTML 标签中的纯文本

func RenameFile

func RenameFile(oldName, newName string) error

RenameFile rename(): Renames a file or directory

func Str2Datetime

func Str2Datetime(datetime string) string

Str2Datetime UTC时间字符串转成时间

func Str2HumanTime

func Str2HumanTime(datetime string) string

Str2HumanTime 将时间字符串转成可读性友好的时间字符串

func Str2UnixTime

func Str2UnixTime(datetime string) int64

Str2UnixTime UTC时间字符串转成时间戳

func TimeAgo

func TimeAgo(t time.Time) string

TimeAgo

func Unescaped

func Unescaped(x string) interface{}

func UnixTime

func UnixTime() int64

UnixTime time()

func UnixTime2Date

func UnixTime2Date(timestamp int64) string

UnixTime2Date 时间戳转成 datetime 字符串 YY-mm-dd

func UnixTime2DateTime

func UnixTime2DateTime(timestamp int64) string

UnixTime2DateTime 时间戳转成 datetime 字符串 YY-mm-dd HH:ii:ss

func UnlinkFile

func UnlinkFile(filename string) error

UnlinkFile unlink() : Deletes a file

func ValidateBaseURI

func ValidateBaseURI(baseURI string, redirectURI string) error

验证跳转域名的合法性:即跳转链接的域名 应该包含 baseURI 的域名 ValidateBaseURI validates that redirectURI is contained in baseURI

Types

This section is empty.

Jump to

Keyboard shortcuts

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