goprimitives

package module
v0.0.0-...-b54f496 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2015 License: MIT Imports: 2 Imported by: 4

README

goprimitives

golang primitives and helpers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration time.Duration

Duration with several helpful helpers

func NewDuration

func NewDuration(duration string) (d *Duration, err error)

NewDuration returns a new Duration instance

func (Duration) IsPositive

func (d Duration) IsPositive() bool

IsPositive returns true if the duration is > 0ns

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

MarshalJSON implements the JSON Marshaller interface

func (*Duration) Set

func (d *Duration) Set(value string) error

Set is used by the flag package to parse cli arguments and set the variable.

func (*Duration) String

func (d *Duration) String() string

func (Duration) TimeDuration

func (d Duration) TimeDuration() time.Duration

TimeDuration converts a Duration to a golang time.Duration

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the JSON Unmarshaller interface. Expects golang duration strings such as "1ms", "5s", etc.

Jump to

Keyboard shortcuts

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