reportingcycle

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package reportingcycle holds the ReportingCycle kind's rules and the one derivation every reader of a cycle must agree on: which periods it has. Periods are derived, never stored (TAXONOMY.md D8); named periods (TAXONOMY.md D40) are listed by the month each ends, so readings, filed by the month their period ends, need no change.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ends

func Ends(spec map[string]any, month string) bool

Ends reports whether month (YYYY-MM) is the end of one of the cycle's named periods. A regular cycle answers true for every month: its readings have never been held to its periods, and are not now.

func Rules

func Rules(doc map[string]any, _ kit.RuleContext) []kit.Problem

Rules holds a cycle to one of its two forms: equal periods of periodMonths from startMonth, or named periods (TAXONOMY.md D40). A list of named periods is all yearly ({name, endMonth}) or all dated ({name, end}), each name used once, and yearly ones run in the order of the year, so no two overlap and the year's start can be read off the last.

Types

type Period

type Period struct {
	// End is the month the period ends, as YYYY-MM: the key a reading is
	// filed under.
	End string
	// Start is the month it starts, as YYYY-MM.
	Start string
	// Name is the period's own name, for a cycle of named periods.
	Name string
	// Label is what a person reads: the name with its year ("Term I
	// 2026/27") for a yearly named period, the name alone for a dated one,
	// and empty for a regular cycle, whose periods are named by month.
	Label string
	// Due is the day its reading is due: the period's last day plus the
	// cycle's dueOffsetDays, as YYYY-MM-DD.
	Due string
}

Period is one period of a cycle.

func Between

func Between(spec map[string]any, from, to string) ([]Period, error)

Between returns the cycle's periods that overlap the months from and to (YYYY-MM, inclusive), in order. A regular cycle's periods line up with its own start month rather than with the range, so the same cycle gives the same periods whatever is asked of it.

Jump to

Keyboard shortcuts

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