utils

package
v0.0.0-...-a4f8eeb Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package utils provide useful functions for skynet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcPage

func CalcPage(page int, size int, len int) (int, int, bool)

func CheckVersion

func CheckVersion(ver string, constraint string) (bool, error)

CheckVersion checks ver with constraint string.

CheckVersion("1.0.1", ">= 1.0, < 1.1")

func DownloadFile

func DownloadFile(ctx context.Context, url string, path string) error

DownloadFile download url to path.

func FileExist

func FileExist(path string) bool

FileExist returns whether file in path exist.

func MD5

func MD5(str string) string

MD5 returns md5 hash of str.

func Max

func Max[T constraints.Ordered](a T, b T) T

func Min

func Min[T constraints.Ordered](a T, b T) T

func MustMarshal

func MustMarshal(v any) string

func RandString

func RandString(n int) string

RandString returns n length random string [a-zA-Z0-9]+

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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