Documentation ¶
Index ¶
- Variables
- type Timeframe
- func (t Timeframe) CompareDuration(d time.Duration) int
- func (t Timeframe) Contains(a time.Time) bool
- func (t Timeframe) Duration() time.Duration
- func (t Timeframe) Format(layout string) string
- func (t Timeframe) IsFinite() bool
- func (t Timeframe) MarshalColumn() ([]byte, error)
- func (t Timeframe) String() string
- func (t *Timeframe) UnmarshalColumn(text []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var Forever = Timeframe{}
A timeframe with no bounds, representing all of time
Functions ¶
This section is empty.
Types ¶
type Timeframe ¶
type Timeframe struct { Since *time.Time `json:"since" db:"since"` Until *time.Time `json:"until" db:"until"` }
A timeframe
func (Timeframe) CompareDuration ¶
CompareDuration compares the duration between t.Since and t.Until with the given duration
func (Timeframe) Contains ¶
Determine if the timeframe contains the specified time. Timeframes are inclusive on the lower bound and exclusive on the upper bound.
func (Timeframe) Duration ¶
What is the duration of the timeframe. If a timeframe is not bounded on both ends, the duration is infinite, which is expressed as a negative value. If Until is before Since, the value will also be negative, this is a logically invalid state that is interpreted as the timeframe being unbounded.
func (Timeframe) MarshalColumn ¶
func (*Timeframe) UnmarshalColumn ¶
Click to show internal directories.
Click to hide internal directories.