helpers

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package helpers 存放辅助方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Empty

func Empty(val interface{}) bool

Empty 类似于 PHP 的 empty() 函数

func FirstElement

func FirstElement(args []string) string

FirstElement 安全地获取 args[0],避免 panic: runtime error: index out of range

func MicrosecondsStr

func MicrosecondsStr(elapsed time.Duration) string

MicrosecondsStr 将 time.Duration 类型(nano seconds 为单位) 输出为小数点后 3 位的 ms (microsecond 毫秒,千分之一秒)

func RandomNumber

func RandomNumber(length int) string

RandomNumber 生成长度为 length 随机数字字符串

func RandomString

func RandomString(length int) string

RandomString 生成长度为 length 的随机字符串

Types

This section is empty.

Jump to

Keyboard shortcuts

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