bytes

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatRound0 = "%.0f"
	FormatRound1 = "%.1f"
	FormatRound2 = "%.2f"
	FormatRound3 = "%.3f"
)

Variables

This section is empty.

Functions

func SetDefaultUnit

func SetDefaultUnit(unit rune)

func ViperDecoderHook

func ViperDecoderHook() libmap.DecodeHookFuncType

Types

type Size

type Size uint64
const (
	SizeNul  Size = 0
	SizeUnit Size = 1
	SizeKilo Size = 1 << 10
	SizeMega Size = 1 << 20
	SizeGiga Size = 1 << 30
	SizeTera Size = 1 << 40
	SizePeta Size = 1 << 50
	SizeExa  Size = 1 << 60
)

func GetSize

func GetSize(s string) (sizeBytes Size, success bool)

func Parse

func Parse(s string) (Size, error)

func ParseByteAsSize

func ParseByteAsSize(p []byte) (Size, error)

func ParseSize

func ParseSize(s string) (Size, error)

func SizeFromFloat64 added in v1.13.1

func SizeFromFloat64(val float64) Size

func SizeFromInt64

func SizeFromInt64(val int64) Size

func (*Size) Add added in v1.14.0

func (s *Size) Add(v uint64)

func (Size) Code

func (s Size) Code(unit rune) string

func (*Size) Div added in v1.14.0

func (s *Size) Div(v float64)

func (Size) ExaBytes

func (s Size) ExaBytes() uint64

func (Size) Float32 added in v1.13.1

func (s Size) Float32() float32

func (Size) Float64

func (s Size) Float64() float64

func (Size) Format

func (s Size) Format(format string) string

func (Size) GigaBytes

func (s Size) GigaBytes() uint64

func (Size) Int added in v1.13.1

func (s Size) Int() int

func (Size) Int32 added in v1.13.1

func (s Size) Int32() int32

func (Size) Int64

func (s Size) Int64() int64

func (Size) KiloBytes

func (s Size) KiloBytes() uint64

func (Size) MarshalCBOR

func (s Size) MarshalCBOR() ([]byte, error)

func (Size) MarshalJSON

func (s Size) MarshalJSON() ([]byte, error)

func (Size) MarshalTOML

func (s Size) MarshalTOML() ([]byte, error)

func (Size) MarshalText

func (s Size) MarshalText() ([]byte, error)

func (Size) MarshalYAML

func (s Size) MarshalYAML() (interface{}, error)

func (Size) MegaBytes

func (s Size) MegaBytes() uint64

func (*Size) Mul added in v1.14.0

func (s *Size) Mul(v float64)

func (Size) PetaBytes

func (s Size) PetaBytes() uint64

func (Size) String

func (s Size) String() string

func (*Size) Sub added in v1.14.0

func (s *Size) Sub(v uint64)

func (Size) TeraBytes

func (s Size) TeraBytes() uint64

func (Size) Uint added in v1.13.1

func (s Size) Uint() uint

func (Size) Uint32 added in v1.13.1

func (s Size) Uint32() uint32

func (Size) Uint64

func (s Size) Uint64() uint64

func (Size) Unit

func (s Size) Unit(unit rune) string

func (*Size) UnmarshalCBOR

func (s *Size) UnmarshalCBOR(bytes []byte) error

func (*Size) UnmarshalJSON

func (s *Size) UnmarshalJSON(bytes []byte) error

func (*Size) UnmarshalTOML

func (s *Size) UnmarshalTOML(i interface{}) error

func (*Size) UnmarshalText

func (s *Size) UnmarshalText(bytes []byte) error

func (*Size) UnmarshalYAML

func (s *Size) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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