units

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidByteFormat = errors.New("not a valid bytes format. Must match" + bytesFormat.String())
)
View Source
var (
	ErrInvalidQuotaFormat = errors.New(
		"not a valid quota. Must match " + percentFormat.String() + " or " + bytesFormat.String(),
	)
)

Functions

func PrettyBytes added in v0.0.12

func PrettyBytes[T int64 | uint64](b T) string

Types

type Bytes

type Bytes struct {
	Bytes int64
}

func DecodeBytes

func DecodeBytes(value string) (Bytes, error)

func (Bytes) String

func (b Bytes) String() string

func (*Bytes) UnmarshalYAML

func (b *Bytes) UnmarshalYAML(value *yaml.Node) error

type DiskQuota

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

func NewDiskQuotaInBytes

func NewDiskQuotaInBytes(bytes Bytes) DiskQuota

func NewDiskQuotaInPercent

func NewDiskQuotaInPercent(percent float64) DiskQuota

func (DiskQuota) Bytes

func (d DiskQuota) Bytes(path string) (Bytes, error)

func (DiskQuota) MarshalYAML

func (d DiskQuota) MarshalYAML() (any, error)

func (*DiskQuota) UnmarshalYAML

func (d *DiskQuota) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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