bytesize

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add added in v1.5.1

func Add(a, b int64) int64

Add stops at the largest byte size instead of wrapping, so a limit set near that size does not go negative. Both values must be zero or more.

func Parse

func Parse(raw string) (int64, error)

Sizes can be plain bytes or use KB, KiB, MB, MiB, GB, and GiB. Every suffix uses a power-of-two multiplier, and fractions must resolve to a whole byte.

Types

type Budget added in v1.5.0

type Budget struct {
	// contains filtered or unexported fields
}

func Of added in v1.5.0

func Of(limit int64) Budget

func ParseBudget added in v1.5.0

func ParseBudget(raw string) (Budget, error)

func Unlimited added in v1.5.0

func Unlimited() Budget

func (Budget) Or added in v1.5.0

func (b Budget) Or(def int64) int64

func (Budget) Set added in v1.5.0

func (b Budget) Set() bool

Jump to

Keyboard shortcuts

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