du

package
v0.6.1 Latest Latest
Warning

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

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

Documentation

Overview

Package du provides disk usage measurement representation. It defines a Size type (uint64) that can be converted to and from human-readable strings with units (K, M, G, etc.).

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSizeSyntax = errors.New("bad size syntax")
)

Functions

This section is empty.

Types

type Size

type Size uint64
const (
	B Size = 1 << (10 * iota)
	K
	M
	G
	T
	P
	E
)

func ParseSize

func ParseSize(s string) (Size, error)

func (Size) Int

func (s Size) Int() int

func (Size) MarshalText added in v0.5.0

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

MarshalText implements the encoding.TextMarshaler interface

func (*Size) Scan added in v0.5.0

func (s *Size) Scan(src any) (err error)

Scan implements the sql.Scanner interface for database deserialization

func (*Size) Set added in v0.5.0

func (s *Size) Set(value string) (err error)

Set implements the flag.Value interface

func (Size) String

func (s Size) String() string

func (*Size) UnmarshalText added in v0.5.0

func (s *Size) UnmarshalText(text []byte) (err error)

UnmarshalText implements the encoding.TextUnmarshaler interface

func (Size) Value added in v0.5.0

func (s Size) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization

Jump to

Keyboard shortcuts

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