interval

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

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

Go to latest
Published: Jan 3, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interval

type Interval struct {
	ID    int
	Tag   string
	Start time.Time
	End   time.Time
}

Interval defines the interval type

func (*Interval) After

func (i *Interval) After(other *Interval) bool

After returns true if interval start after other

func (*Interval) Before

func (i *Interval) Before(other *Interval) bool

Before return true if the interval started before other, or if start times are the same and it end before other, false otherwise

func (*Interval) Close

func (i *Interval) Close()

Closes closes the interval by setting its end date to time.Now()

func (*Interval) Duration

func (i *Interval) Duration() time.Duration

Duration returns the total duration of the interval. If the interval is not closed, it will return the currently elapsed time.

func (*Interval) Equal

func (i *Interval) Equal(other *Interval) bool

Equal returns true if the interval has the same start and end as other

func (*Interval) IsClosed

func (i *Interval) IsClosed() bool

IsClosed returns true in the interval has a non-zero end date

type SortByDate

type SortByDate []Interval

SortByDate defines an interval slice that can be sorted by the interval dates

func (SortByDate) Len

func (s SortByDate) Len() int

Len implements the sort.Interface

func (SortByDate) Less

func (s SortByDate) Less(i, j int) bool

Less implements the sort.Interface

func (SortByDate) Swap

func (s SortByDate) Swap(i, j int)

Swap implements the sort.Interface

Jump to

Keyboard shortcuts

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