Documentation
¶
Index ¶
- Constants
- type Date
- func (date Date) AddDate(years, months, days int) Date
- func (date Date) AddDays(days int) Date
- func (date Date) After(other Date) bool
- func (date Date) Before(other Date) bool
- func (date Date) Equals(other Date) bool
- func (date Date) MarshalJSON() ([]byte, error)
- func (date *Date) Scan(value interface{}) error
- func (date Date) String() string
- func (date *Date) UnmarshalJSON(text []byte) error
- func (date Date) Value() (driver.Value, error)
- func (date Date) Within(term Range) bool
- type Range
- func Empty() (term Range)
- func EntireMonth(year int, month time.Month) (term Range)
- func EntireYear(year int) (term Range)
- func Forever() (term Range)
- func Infinity() Range
- func Never() Range
- func NewRange(start, end Date) (term Range)
- func OnlyToday() Range
- func SingleDay(date Date) Range
- func StartBoundedRange(start Date) (term Range)
- func (term Range) Contains(other Range) bool
- func (term Range) Days() int
- func (term Range) DoesNotContain(other Range) bool
- func (term Range) Equals(other Range) bool
- func (term Range) Error() error
- func (term Range) Intersection(other Range) (intersect Range)
- func (term Range) IsEmpty() bool
- func (term Range) IsInfinity() bool
- func (term Range) IsZero() bool
- func (term Range) MarshalJSON() ([]byte, error)
- func (term Range) Overlaps(other Range) bool
- func (term *Range) Scan(value interface{}) error
- func (term Range) String() string
- func (term Range) Union(other Range) (union Range)
- func (term Range) Value() (driver.Value, error)
Constants ¶
const ISO8601Date = "2006-01-02"
ISO8601Date uses ISO 8601 as a default for parsing and rendering
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
func ParseUsingLayout ¶
ParseUsingLayout calls Parse with a different date layout
func (Date) AddDate ¶
AddDate adds any number of years, months, and days to the date. It proxies to the embedded time.Time, but returns a Date
func (Date) After ¶
After returns true if the given date is after (and not equal) to the current date
func (Date) Before ¶
Before returns true if the given date is before (and not equal) to the current date
func (Date) MarshalJSON ¶
MarshalJSON returns the JSON output of a Date. Null will return a zero value date.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON converts a byte array into a Date
type Range ¶
type Range struct { Start Date `json:"start"` End Date `json:"end"` // contains filtered or unexported fields }
Range is a start and end date
func EntireMonth ¶
EntireMonth creates a Range that includes the entire month
func EntireYear ¶
EntireYear creates a Range that includes the entire year
func StartBoundedRange ¶
func (Range) Contains ¶
Contains returns true if the given range is entirely within the the range - inclusive
func (Range) Days ¶
Days returns the number of days in the range zero will be returned for infinity TODO or -1
func (Range) DoesNotContain ¶
func (Range) Error ¶
Error returns an error if there is both a start and end date and the given start date is not before the end date.
func (Range) Intersection ¶
Intersection returns a new range consisting of the days the given ranges have in common
func (Range) MarshalJSON ¶
MarshalJSON returns the JSON output of a Range. Empty ranges will return null
func (Range) Overlaps ¶
Overlaps returns true if the given range has at least one day in common with the range
func (*Range) Scan ¶
Scan converts the given database value to a Range, possibly returning an error if the conversion failed