Documentation
¶
Index ¶
- func ExtractCookieAuth(r *http.Request, config *config.Config) (username *string, err error)
- func FmtWakatimeDuration(d time.Duration) string
- func FormatDate(date time.Time) string
- func FormatDateHuman(date time.Time) string
- func FormatDateTime(date time.Time) string
- func FormatDateTimeHuman(date time.Time) string
- func MustParseInterval(interval string) *models.IntervalKey
- func MustResolveIntervalRawTZ(interval string, tz *time.Location) (from, to time.Time)
- func ParseDateTimeTZ(date string, tz *time.Location) (time.Time, error)
- func ParseInterval(interval string) (*models.IntervalKey, error)
- func ParseSummaryFilters(r *http.Request) *models.Filters
- func ParseSummaryParams(r *http.Request) (*models.SummaryParams, error)
- func ResolveIntervalRawTZ(interval string, tz *time.Location) (err error, from, to time.Time)
- func ResolveIntervalTZ(interval *models.IntervalKey, tz *time.Location) (err error, from, to time.Time)
- func ResolveMaximumRange(days int) (error, *models.IntervalKey)
- func RespondJSON(w http.ResponseWriter, r *http.Request, status int, object interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractCookieAuth ¶
func FmtWakatimeDuration ¶
func FormatDate ¶
func FormatDateHuman ¶
func FormatDateTime ¶
func FormatDateTimeHuman ¶
func MustParseInterval ¶
func MustParseInterval(interval string) *models.IntervalKey
func ParseDateTimeTZ ¶
ParseDateTimeTZ attempts to parse the given date string from multiple formats. First, a time-zoned date-time string (e.g. 2006-01-02T15:04:05+02:00) is tried Second, a non-time-zoned date-time string (e.g. 2006-01-02 15:04:05) is tried at the given zone Third, a non-time-zoned date string (e.g. 2006-01-02) is tried at the given zone Example: - Server runs in CEST (UTC+2), requesting user lives in PDT (UTC-7). - 2021-04-25T10:30:00Z, 2021-04-25T3:30:00-0100 and 2021-04-25T12:30:00+0200 are equivalent, they represent the same point in time - When user requests non-time-zoned range (e.g. 2021-04-25T00:00:00), but has their time zone properly configured, this will resolve to 2021-04-25T09:00:00
func ParseInterval ¶
func ParseInterval(interval string) (*models.IntervalKey, error)
func ParseSummaryParams ¶
func ParseSummaryParams(r *http.Request) (*models.SummaryParams, error)
func ResolveIntervalRawTZ ¶
func ResolveIntervalTZ ¶
func ResolveMaximumRange ¶
func ResolveMaximumRange(days int) (error, *models.IntervalKey)
ResolveMaximumRange returns the interval label (e.g. "last_7_days") of the maximum allowed range when having opted to share this many days or an error for days == 0.
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, r *http.Request, status int, object interface{})
Types ¶
This section is empty.