counts

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: MIT Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Binary = Humaner{
	// contains filtered or unexported fields
}
View Source
var Metric = Humaner{
	// contains filtered or unexported fields
}

Functions

This section is empty.

Types

type Count32

type Count32 uint32

A count of something, capped at math.MaxUint32.

func NewCount32

func NewCount32(n uint64) Count32

func (*Count32) AdjustMaxIfNecessary

func (n1 *Count32) AdjustMaxIfNecessary(n2 Count32) bool

AdjustMaxIfNecessary adjusts `*n1` to be `max(*n1, n2)`. Return true iff `n2` was greater than `*n1`.

func (*Count32) AdjustMaxIfPossible

func (n1 *Count32) AdjustMaxIfPossible(n2 Count32) bool

AdjustMaxIfPossible adjusts `*n1` to be `max(*n1, n2)`. Return true iff `n2` was greater than or equal to `*n1`.

func (*Count32) Increment

func (n1 *Count32) Increment(n2 Count32)

Increment `*n1` by `n2`, capped at math.MaxUint32.

func (Count32) Plus

func (n1 Count32) Plus(n2 Count32) Count32

Return the sum of two Count32s, capped at math.MaxUint32.

func (Count32) ToUint64

func (n Count32) ToUint64() (uint64, bool)

type Count64

type Count64 uint64

A count of something, capped at math.MaxUint64.

func NewCount64

func NewCount64(n uint64) Count64

func (*Count64) AdjustMaxIfNecessary

func (n1 *Count64) AdjustMaxIfNecessary(n2 Count64) bool

AdjustMaxIfNecessary adjusts `*n1` to be `max(*n1, n2)`. Return true iff `n2` was greater than `*n1`.

func (*Count64) AdjustMaxIfPossible

func (n1 *Count64) AdjustMaxIfPossible(n2 Count64) bool

AdjustMaxIfPossible adjusts `*n1` to be `max(*n1, n2)`. Return true iff `n2` was greater than or equal to `*n1`.

func (*Count64) Increment

func (n1 *Count64) Increment(n2 Count64)

Increment `*n1` by `n2`, capped at math.MaxUint64.

func (Count64) Plus

func (n1 Count64) Plus(n2 Count64) Count64

Return the sum of two Count64s, capped at math.MaxUint64.

func (Count64) ToUint64

func (n Count64) ToUint64() (uint64, bool)

type Humanable added in v1.3.0

type Humanable interface {
	// Return the value as a uint64, and a boolean telling whether it
	// overflowed.
	ToUint64() (uint64, bool)
}

A quantity that can be made human-readable using Human().

type Humaner

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

An object that can format a Humanable in human-readable format.

func (*Humaner) Format added in v1.3.0

func (h *Humaner) Format(value Humanable, unit string) (string, string)

Format values, aligned, in `len(unit) + 10` or fewer characters (except for extremely large numbers).

func (*Humaner) FormatNumber added in v1.3.0

func (h *Humaner) FormatNumber(n uint64, unit string) (string, string)

Format n, aligned, in `len(unit) + 10` or fewer characters (except for extremely large numbers).

func (*Humaner) Name added in v1.3.0

func (h *Humaner) Name() string

type Prefix

type Prefix struct {
	Name       string
	Multiplier uint64
}

Jump to

Keyboard shortcuts

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