gtbox_unit

package
v0.1.76 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnitFormatWith1024 added in v0.1.69

func UnitFormatWith1024(baseWithByte *big.Float, fSed int) string

UnitFormatWith1024 单位计算公式 以byte 为单位传入,根据数值不同换算成进制单位MB、GB等 fSed 小数点保留位数

Types

type GTUnit

type GTUnit struct {
	BitInfo   *gtbox_unit_bit.GTUnitBit
	BytesInfo *gtbox_unit_bytes.GTUnitBytes
}

func NewWithBitFormat

func NewWithBitFormat(bitString string, resultUnitType UnitType) *GTUnit

NewWithBitFormat 通过 bit(比特) 创建 Model bitString bit单位的 bit值 resultUnitType 返回值的单位 默认不做处理,推荐自动格式化

func NewWithBytesFormat

func NewWithBytesFormat(BytesString string, resultUnitType UnitType) *GTUnit

NewWithBytesFormat 通过 Bytes(字节) 创建 Model BytesString Byte 单位的 Bytes值 resultUnitType 返回值的单位 默认不做处理,推荐自动格式化

type UnitType

type UnitType int

UnitBits Bit 比特 显示单位 Model

const (
	UnitTypeNone  UnitType = iota // 不做转换
	UnitTypeAuto                  // 自动根据位数换算单位
	UnitTypeKilo                  // Kilo 千
	UnitTypeMega                  // Mega 兆
	UnitTypeGiga                  // Giga 吉
	UnitTypeTera                  // Tera 太
	UnitTypePeta                  // Peta 拍
	UnitTypeExa                   // Exa 艾
	UnitTypeZetta                 // Zetta 泽
	UnitTypeYotta                 // Yotta 尧

)

func (UnitType) String

func (aType UnitType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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