util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateDayFormat = "20060102"
)

Variables

This section is empty.

Functions

func DateNumber added in v1.1.0

func DateNumber() string

func EscapeHtml

func EscapeHtml(value string) string

func FormatDatetime added in v1.1.0

func FormatDatetime(timestamp int64) string

func GenerateId

func GenerateId() string

func IsDateFormat added in v1.1.0

func IsDateFormat(date string) bool

func Location added in v1.1.0

func Location() *time.Location

func NewMsgId

func NewMsgId() string

func ParseHtmlImage

func ParseHtmlImage(text string) string

解析 Md 文本中的图片信息

func ParseHtmlImageAll

func ParseHtmlImageAll(text string) []string

解析 Md 文本中的所有图片信息

func ParseIds

func ParseIds(str string) []int

func ReplaceImgAll

func ReplaceImgAll(value string) string

func Retry

func Retry(num int, sleep time.Duration, fn func() error) error

func ToMap

func ToMap[T any, K int | string](arr []T, fn func(T) K) map[K]T

切片转 map

func Unique

func Unique[T IntInterface | string](data []T) []T

切片去重

Types

type IntInterface

type IntInterface interface {
	uint | uint8 | uint16 | uint32 | uint64 | int | int8 | int16 | int32 | int64
}

type RoundRobin

type RoundRobin struct {
	CurIndex int
}

func (*RoundRobin) RoundRobin

func (roundRobin *RoundRobin) RoundRobin(values []string) (value string)

轮询模式

Jump to

Keyboard shortcuts

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