quantities

package
v0.0.0-...-2e12031 Latest Latest
Warning

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

Go to latest
Published: May 26, 2018 License: GPL-3.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Floating

type Floating struct {
	Val float64
}

Floating point quantity

func (*Floating) Float

func (t *Floating) Float() float64

Float returns the value as a float64

func (*Floating) FromFloat

func (t *Floating) FromFloat(val float64)

FromFloat stores the provided value inside t

func (*Floating) FromString

func (t *Floating) FromString(valstr string)

FromString converts a provided numerical value as a string into a float and stores it inside t

func (*Floating) MarshalJSON

func (t *Floating) MarshalJSON() (b []byte, e error)

func (*Floating) String

func (t *Floating) String() string

String returns the value as a string

func (*Floating) Type

func (t *Floating) Type() string

Type returns the type of the quantity

func (*Floating) UnmarshalJSON

func (t *Floating) UnmarshalJSON(b []byte) error

type NumericalQuantity

type NumericalQuantity interface {
	Quantity
	Float() float64
	FromFloat(val float64)
}

type Ping

type Ping struct {
	HostName    string
	IPAddr      string
	PacketsRecv int64
	PacketsSent int64
	MinRtt      time.Duration
	MaxRtt      time.Duration
	AvgRtt      time.Duration
	StdDevRtt   time.Duration
}

Ping quantity

func (*Ping) FromString

func (p *Ping) FromString(valstr string)

FromString converts a provided numerical value as a string into a float and stores it inside t

func (*Ping) MarshalJSON

func (p *Ping) MarshalJSON() (b []byte, e error)

func (*Ping) String

func (p *Ping) String() string

String returns the value as a string

func (*Ping) Type

func (p *Ping) Type() string

Type returns the type of the quantity

func (*Ping) UnmarshalJSON

func (p *Ping) UnmarshalJSON(b []byte) error

type Quantity

type Quantity interface {
	Type() string
	String() string
	FromString(valstr string)
}

type Temperature

type Temperature struct {
	Val float64
}

Temperature quantity

func (*Temperature) Degrees

func (t *Temperature) Degrees() float64

Degrees returns the temperature value in degrees centigrate

func (*Temperature) Fahrenheit

func (t *Temperature) Fahrenheit() float64

Fahrenheit returns the temperature value in fahrenheit

func (*Temperature) Float

func (t *Temperature) Float() float64

Float returns the value as a float64

func (*Temperature) FromFloat

func (t *Temperature) FromFloat(val float64)

FromFloat stores the provided value inside t

func (*Temperature) FromString

func (t *Temperature) FromString(valstr string)

FromString converts a provided numerical value as a string into a float and stores it inside t

func (*Temperature) Kelvin

func (t *Temperature) Kelvin() float64

Kelvin returns the temperature value in kelvin

func (*Temperature) MarshalJSON

func (t *Temperature) MarshalJSON() (b []byte, e error)

func (*Temperature) String

func (t *Temperature) String() string

String returns the value as a string

func (*Temperature) Type

func (t *Temperature) Type() string

Type returns the type of the quantity

func (*Temperature) UnmarshalJSON

func (t *Temperature) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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