mathutil

package
v0.0.0-...-754e97a Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConvertFail = errors.New("convert data type is failure")
)

Functions

func DataSize

func DataSize(size uint64) string

DataSize format value. alias format.DataSize()

func ElapsedTime

func ElapsedTime(startTime time.Time) string

ElapsedTime calc elapsed time 计算运行时间消耗 单位 ms(毫秒)

func Float

func Float(in interface{}) (float64, error)

Float convert value to float64

func HowLongAgo

func HowLongAgo(sec int64) string

HowLongAgo calc time. alias format.HowLongAgo()

func Int

func Int(in interface{}) (int, error)

Int convert string to int

func Int64

func Int64(in interface{}) (int64, error)

Int64 convert string to int64

func MustFloat

func MustFloat(in interface{}) float64

MustFloat convert value to float64

func MustInt

func MustInt(in interface{}) int

MustInt convert string to int

func MustInt64

func MustInt64(in interface{}) int64

MustInt64 convert

func MustUint

func MustUint(in interface{}) uint64

MustUint convert string to uint

func Percent

func Percent(val, total int) float64

Percent returns a values percent of the total

func ToFloat

func ToFloat(in interface{}) (f64 float64, err error)

ToFloat convert value to float64

func ToInt

func ToInt(in interface{}) (iVal int, err error)

ToInt convert string to int

func ToInt64

func ToInt64(in interface{}) (i64 int64, err error)

ToInt64 convert string to int64

func ToUint

func ToUint(in interface{}) (u64 uint64, err error)

ToUint convert string to uint

func Uint

func Uint(in interface{}) (uint64, error)

Uint convert string to uint

Types

This section is empty.

Jump to

Keyboard shortcuts

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