Documentation ¶
Index ¶
- Constants
- func BoolToInt(value bool) int
- func DateNumber() string
- func EscapeHtml(value string) string
- func FindAddress(ctx context.Context, ip string) (string, error)
- func FormatDatetime(timestamp int64) string
- func GenFileName(ext string) string
- func GenImageName(ext string, width, height int) string
- func GenValidateCode(length int) string
- func GenerateId() string
- func HttpDownloadFile(ctx context.Context, fileURL string, proxyURL ...string) []byte
- func HttpGet(ctx context.Context, url string, header map[string]string, data g.Map, ...) error
- func HttpPost(ctx context.Context, url string, header map[string]string, ...) error
- func HttpPostJson(ctx context.Context, url string, header map[string]string, ...) error
- func IsDateFormat(date string) bool
- func Location() *time.Location
- func NewMsgId() string
- func NewSecretKey(userId, length int, prefix ...string) string
- func ParseHtmlImage(text string) string
- func ParseHtmlImageAll(text string) []string
- func ParseIds(str string) []int
- func Random(length int) string
- func RenderTemplate(data any) (string, error)
- func ReplaceImgAll(value string) string
- func Retry(num int, sleep time.Duration, fn func() error) error
- func Strip(s string) string
- func ToMap[T any, K int | string](arr []T, fn func(T) K) map[K]T
- func Unique[T IntInterface | string](data []T) []T
- func WebSocketClient(ctx context.Context, wsURL string, messageType int, message []byte, ...) (*websocket.Conn, error)
- func WebSocketClientOnlyReceive(ctx context.Context, wsURL string, result chan []byte, proxyURL ...string) (*websocket.Conn, error)
- type ImageInfo
- type ImageMeta
- type IntInterface
- type IpAddressResponse
- type RoundRobin
Constants ¶
View Source
const (
DateDayFormat = "20060102"
)
Variables ¶
This section is empty.
Functions ¶
func DateNumber ¶
func DateNumber() string
func EscapeHtml ¶
func FormatDatetime ¶
func GenFileName ¶
func GenerateId ¶
func GenerateId() string
func HttpDownloadFile ¶
func HttpPostJson ¶ added in v1.1.0
func IsDateFormat ¶
func NewSecretKey ¶ added in v1.1.0
func ParseHtmlImageAll ¶
ParseHtmlImageAll 解析 Md 文本中的所有图片信息
func RenderTemplate ¶
func ReplaceImgAll ¶
func Strip ¶
Strip returns the given string sans any Markdown. Where necessary, elements are replaced with their best textual forms, so for example, hyperlinks are stripped of their URL and become only the link text, and images lose their URL and become only the alt text.
func WebSocketClient ¶
Types ¶
type IntInterface ¶
type IpAddressResponse ¶ added in v1.0.0
type RoundRobin ¶ added in v1.0.0
type RoundRobin struct {
CurIndex int
}
func (*RoundRobin) RoundRobin ¶ added in v1.0.0
func (roundRobin *RoundRobin) RoundRobin(values []string) (value string)
轮询模式
Click to show internal directories.
Click to hide internal directories.