memstr

package module
v0.0.0-...-569a1c5 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2016 License: MIT Imports: 3 Imported by: 0

README

memstr

Parse human readable memory strings to their size in integer form.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrBadFormat means the string was incorreclty formatted.
	ErrBadFormat = errors.New("bad format")

	// ErrInvalidSizeString means the string was formatted correctly, but the size was invalid
	ErrInvalidSizeString = errors.New("invalid size string")
)

Functions

func CompareMemory

func CompareMemory(x, y string) (int, error)

CompareMemory given two size strings, compare them. given CompareMemory(x,y) 1 : x > y 0 : x == y -1 : x < y -2 : there was an error

func Parse

func Parse(s string) (int64, error)

Parse given a string, parse the size of memory it represents ie "1K"= 1024 bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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