Documentation
¶
Overview ¶
Package histwin carries the free plan's history window in a request context.
A free account (Rivolt Pro, Sprint 14) sees the last FreeDays days of drives and charges, and the current and previous two calendar months of statements. The window lives only in the context of a request that a windowed route's middleware has stamped: background jobs (the recorder, recaps, the statement email), repairs, the export and every other context carry none, so they see everything. The stores (drives, charges) narrow their reads when a window is present; nothing here deletes or hides a row from storage.
It has no dependencies so the stores can import it.
Index ¶
Constants ¶
const FreeDays = 90
FreeDays is the length of the free window, in days.
Variables ¶
var ErrOutside = errors.New("histwin: outside the free history window")
ErrOutside is returned by a single-row read (a drive or charge by id) of a row older than the window. The row exists; the free plan does not show it.
Functions ¶
func Allows ¶
Allows reports whether a row that started at t is inside the window in ctx (always, when there is none).
func Clamp ¶
Clamp raises a client-supplied lower bound to the window: the result is never earlier than the window's start. A zero from means "no lower bound" and becomes the window's start.
Types ¶
type W ¶
type W struct {
// Since is the oldest start time a drive, charge or other timed row may have to be shown.
Since time.Time
// MoneyFrom is the first instant of the oldest calendar month (UTC) the Money statements show: the current month and the two before.
MoneyFrom time.Time
// Days is FreeDays, for clients.
Days int
}
W is a window. The zero value is no window.