utils

package
v0.0.0-...-50ae3de Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBatchSize = 100
View Source
const YYMMDDUnderline = "2006-01-02"

Variables

This section is empty.

Functions

func ComparePwd

func ComparePwd(hashPwd string, pwd string) bool

func Cur2TodayEndDuration

func Cur2TodayEndDuration() time.Duration

func DecodeConfigFile

func DecodeConfigFile(path string, config any) error

func ExcludeSlice

func ExcludeSlice(all, exclude []string) []string

func GenPwd

func GenPwd(ctx context.Context, pwd string) ([]byte, error)

func GenerateToken

func GenerateToken(uid int64, expireDuration time.Duration, secretKey string) (string, error)

func HtmlUnescapeAndTrim

func HtmlUnescapeAndTrim(htmlStr string) string

func IsImage

func IsImage(name string) bool

func IsInArray

func IsInArray(item int, array []int) bool

func IsInSlice

func IsInSlice[T constraints.Ordered](a T, s []T) bool

func IsInStrArray

func IsInStrArray(item string, array []string) bool

func LoadConfigFile

func LoadConfigFile(cfgPath string, cfg Configuration) error

func NowUTC

func NowUTC() time.Time

func ParseDay

func ParseDay(tStr string) (time.Time, error)

func PwdFormat

func PwdFormat(pwd string) bool

func RandShuffle

func RandShuffle(slice []interface{})

func Time2TimeStamp

func Time2TimeStamp(t time.Time) int64

func TimeStamp2Time

func TimeStamp2Time(tStamp int64) time.Time

func TimeStamp2UTCTimeString

func TimeStamp2UTCTimeString(tStamp int64) string

func TodayStartUTC

func TodayStartUTC() time.Time

func TrimHtml

func TrimHtml(htmlStr string) string

func UniqueArray

func UniqueArray(iArray []int64) []int64

func UniqueStr

func UniqueStr(slice []string) []string

func Url2ObjectKey

func Url2ObjectKey(ctx context.Context, rawURL string) (string, error)

func Url2ObjectKeyList

func Url2ObjectKeyList(ctx context.Context, rawURLs []string) ([]string, error)

Types

type Batcher

type Batcher struct {
	// contains filtered or unexported fields
}

func NewBatcher

func NewBatcher(count, batchSize int) (*Batcher, error)

func (*Batcher) Iter

func (i *Batcher) Iter(start, length *int) bool

type Configuration

type Configuration interface {
	Verify() error
}

type JwtClaims

type JwtClaims struct {
	Uid            int64
	StandardClaims jwt.StandardClaims
}

func (JwtClaims) Valid

func (j JwtClaims) Valid() error

Jump to

Keyboard shortcuts

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