basic

package
v0.0.0-...-4bec719 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Date

func Date() string

func Date2Second

func Date2Second(date string) int64

func DateTime

func DateTime() string

func DateTime2Second

func DateTime2Second(datetime string) int64

func EncryptPassword

func EncryptPassword(data []byte) (res string)

func MarshalGob

func MarshalGob(data interface{}) ([]byte, error)

func MarshalMsPack

func MarshalMsPack(data interface{}) ([]byte, error)

func NowMilliSecond

func NowMilliSecond() int64

func NowSecond

func NowSecond() int64

func NowSecondWithLocation

func NowSecondWithLocation(name string) int64

NowSecondWithLocation ex. NowSecondWithLocation("Asia/Shanghai")

func Perm

func Perm(n int) []int

Perm 返回半开区间 [0,n) 内整数伪随机排列

func RandFloat64

func RandFloat64() float64

RandFloat64 从 [0.0, 1.0] 中获取随机数

func RandIntN

func RandIntN(n int) int

RandIntN 从 [0, n) 随机获取一个整数

func RandIntRange

func RandIntRange(min, max int) int

RandIntRange 从 [min, max) 中随机获取一个整数

func RandNormFloat64

func RandNormFloat64() float64

RandNormFloat64 从均值为0, 标准差为1的正态分布获取随机浮点数

func RandNormFloat64WithMeanStddev

func RandNormFloat64WithMeanStddev(mean, stddev float64) float64

RandNormFloat64WithMeanStddev 从均值为mean, 标准差为stddev 的正态分布中获取随机浮点数

func Second2Date

func Second2Date(second int64) string

func Second2DateTime

func Second2DateTime(second int64) string

func Shuffle

func Shuffle[T any](slice []T)

Shuffle 打乱数组中元素的顺序

func Sign

func Sign(num float64) int

Sign 符号函数

func Threshold

func Threshold(x float64) float64

Threshold 阈值函数

func UnmarshalGob

func UnmarshalGob(data []byte, res interface{}) error

func UnmarshalJson

func UnmarshalJson(data []byte, config interface{}, errorOnUnmatchedKeys bool) (err error)

func UnmarshalMsPack

func UnmarshalMsPack(data []byte, res interface{}) error

func UnmarshalToml

func UnmarshalToml(data []byte, config interface{}, errorOnUnmatchedKeys bool) error

func UnmarshalYaml

func UnmarshalYaml(data []byte, config interface{}, errorOnUnmatchedKeys bool) (err error)

Types

type UnmatchedTomlKeysError

type UnmatchedTomlKeysError struct {
	Keys []toml.Key
}

func (*UnmatchedTomlKeysError) Error

func (e *UnmatchedTomlKeysError) Error() string

Jump to

Keyboard shortcuts

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