utility

package
v0.0.0-...-d0f20ad Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DurationToString

func DurationToString(duration time.Duration) string

DurationToString formats a time.Duration as a string with the assumption that a year always has 365 days and a day always has 24h. (The former doesn't work in leap years, the latter is broken by DST switches, not to speak about leap seconds, but those are not even treated properly by the duration strings in the standard library.)

func GraphLinkForExpression

func GraphLinkForExpression(expr string) string

GraphLinkForExpression creates an escaped relative link to the graph view of the provided expression.

func NewDeadlineClient

func NewDeadlineClient(timeout time.Duration) *http.Client

NewDeadlineClient returns a new http.Client which will time out long running requests.

func StringToDuration

func StringToDuration(durationStr string) (duration time.Duration, err error)

StringToDuration parses a string into a time.Duration, assuming that a year always has 365d, a week 7d, a day 24h. See DurationToString for problems with that.

func TableLinkForExpression

func TableLinkForExpression(expr string) string

TableLinkForExpression creates an escaped relative link to the table view of the provided expression.

Types

type Set

type Set map[interface{}]struct{}

Set is a type which models a set.

func (Set) Add

func (s Set) Add(v interface{})

Add adds an item to the set.

func (Set) Elements

func (s Set) Elements() []interface{}

Elements returns a slice containing all elements in the set.

func (Set) Has

func (s Set) Has(v interface{}) bool

Has returns true if an element is contained in the set.

func (Set) Intersection

func (s Set) Intersection(o Set) Set

Intersection returns a new set with items that exist in both sets.

func (Set) Remove

func (s Set) Remove(v interface{})

Remove removes an item from the set.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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