Back to godoc.org

Package data

v0.0.9
Latest Go to latest
Published: Jun 24, 2020 | License: Apache-2.0 | Module: github.com/grailbio/base

Overview

Package data provides functionality for measuring and displaying data quantities.

Index

Package Files

type Size

type Size int64

A Size represents a data quantity in number of bytes.

const (
	B Size = 1 << (10 * iota)
	KiB
	MiB
	GiB
	TiB
	PiB
	EiB
)

Common data quantities.

func (Size) Bytes

func (s Size) Bytes() int64

Bytes returns the size as an integer byte count.

func (Size) Count

func (s Size) Count(u Size) float64

Count returns the number of us in s.

func (Size) String

func (s Size) String() string

String returns a string representation of the data quantity b, picking the largest appropriate unit.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier