mathutil

package
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 6 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 added in v0.2.2

func Float(s string) (float64, error)

Float convert string to float

func HowLongAgo

func HowLongAgo(sec int64) string

HowLongAgo calc time. alias format.HowLongAgo()

func Int added in v0.2.2

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

Int convert string to int

func Int64 added in v0.2.2

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

Int64 convert string to int64

func MustFloat added in v0.2.2

func MustFloat(s string) float64

MustFloat convert string to float

func MustInt added in v0.2.2

func MustInt(in interface{}) int

MustInt convert string to int

func MustInt64 added in v0.2.2

func MustInt64(in interface{}) int64

MustInt64 convert

func MustUint added in v0.2.2

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 added in v0.2.2

func ToFloat(s string) (float64, error)

ToFloat convert string to float

func ToInt added in v0.2.2

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

ToInt convert string to int

func ToInt64 added in v0.2.2

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

ToInt64 convert string to int64

func ToUint added in v0.2.2

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

ToUint convert string to uint

func Uint added in v0.2.2

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