bytes

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 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 SizeFromInt64

func SizeFromInt64(val int64) Size

func (Size) Code

func (s Size) Code(unit rune) string

func (Size) ExaBytes

func (s Size) ExaBytes() uint64

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) 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) PetaBytes

func (s Size) PetaBytes() uint64

func (Size) String

func (s Size) String() string

func (Size) TeraBytes

func (s Size) TeraBytes() uint64

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