number

package
v10.0.37 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// BigByte is one byte in bit.Ints
	BigByte = big.NewInt(1)
	// BigKByte is 1,024 bytes in bit.Ints
	BigKByte = (&big.Int{}).Mul(BigByte, bigIECExp)
	// BigMByte is 1,024 k bytes in bit.Ints
	BigMByte = (&big.Int{}).Mul(BigKByte, bigIECExp)
	// BigGByte is 1,024 m bytes in bit.Ints
	BigGByte = (&big.Int{}).Mul(BigMByte, bigIECExp)
	// BigTByte is 1,024 g bytes in bit.Ints
	BigTByte = (&big.Int{}).Mul(BigGByte, bigIECExp)
	// BigPByte is 1,024 t bytes in bit.Ints
	BigPByte = (&big.Int{}).Mul(BigTByte, bigIECExp)
	// BigEByte is 1,024 p bytes in bit.Ints
	BigEByte = (&big.Int{}).Mul(BigPByte, bigIECExp)
	// BigZByte is 1,024 e bytes in bit.Ints
	BigZByte = (&big.Int{}).Mul(BigEByte, bigIECExp)
	// BigYByte is 1,024 z bytes in bit.Ints
	BigYByte = (&big.Int{}).Mul(BigZByte, bigIECExp)
)

Functions

func BoolPointer

func BoolPointer(v bool) *bool

BoolPointer will return a pointer to the bool value

func BoolToStringAsInt

func BoolToStringAsInt(bo bool) string

BoolToStringAsInt returns a 1 or 0 string for a bool

func Float32Pointer

func Float32Pointer(v float32) *float32

Float32Pointer returns a float64 as pointer

func Float64Pointer

func Float64Pointer(v float64) *float64

Float64Pointer returns a float64 as pointer

func Int32Pointer

func Int32Pointer(v int32) *int32

Int32Pointer will return the address of the value as a pointer or nil if 0

func Int64Pointer

func Int64Pointer(v int64) *int64

Int64Pointer will return the address of the value as a pointer or nil if 0

func IntPointer

func IntPointer(v int) *int

IntPointer will return the address of the value as a pointer or nil if 0

func NullString

func NullString(value interface{}) string

NullString will return NULL if the value is empty or the value if not

func Percent

func Percent(a int, b int) float64

Percent will safely return a percentage for two numbers diving a / b

func Percent32

func Percent32(a int32, b int32) float64

Percent32 will safely return a percentage for two numbers diving a / b

func Percent64

func Percent64(a int64, b int64) float64

Percent64 will safely return a percentage for two numbers diving a / b

func PercentFloat32

func PercentFloat32(a float32, b float32) float64

PercentFloat32 will safely return a percentage for two numbers diving a / b

func PercentFloat64

func PercentFloat64(a float64, b float64) float64

PercentFloat64 will safely return a percentage for two numbers diving a / b

func ToBool

func ToBool(v string) bool

ToBool returns bool for string and if parse error, return false

func ToBoolAny

func ToBoolAny(v interface{}) bool

ToBoolAny returns bool for interface{} and if parse error, return false

func ToBytesSize

func ToBytesSize(v int64) string

ToBytesSize produces a human readable representation of an bytes size

ToBytesSize(82854982) -> 83 MB

func ToBytesSizeBigInt

func ToBytesSizeBigInt(s *big.Int) string

ToBytesSizeBigInt produces a human readable representation of an bytes size

ToBytesSizeBigInt(big.NewInt(82854982)) -> 83 MB

func ToFloat64

func ToFloat64(v string) float64

ToFloat64 converts a string to a 64-bit float or return 0

func ToFloat64Any

func ToFloat64Any(v interface{}) float64

ToFloat64Any converts an interface{} to a 64-bit float or return 0

func ToInt32

func ToInt32(v string) int32

ToInt32 converts a string to a base 10 32-bit integer or return 0

func ToInt32Any

func ToInt32Any(v interface{}) int32

ToInt32Any converts an interface{} to a base 10 32-bit integer or return 0

func ToInt64

func ToInt64(v string) int64

ToInt64 converts a string to a base 10 64-bit integer or return 0

func ToInt64Any

func ToInt64Any(v interface{}) int64

ToInt64Any converts an interface{} to a base 10 64-bit integer or return 0

Types

This section is empty.

Jump to

Keyboard shortcuts

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