Versions in this module Expand all Collapse all v0 v0.1.1 Sep 8, 2026 v0.1.0 Sep 3, 2026 Changes in this version + const DayTypeAdjustedRestDay + const DayTypeAdjustedWorkDay + const DayTypeFestivalRest + var ErrYearNotLoaded = errors.New("年份配置未加载") + type Adjust struct + Off []time.Time + Work []time.Time + type Calendar struct + func NewCalendar(s *Store) *Calendar + func (c *Calendar) HasYear(year int) bool + func (c *Calendar) IsRest(date time.Time) (bool, error) + func (c *Calendar) IsWork(date time.Time) (bool, error) + func (c *Calendar) Query(date time.Time) (DayType, error) + func (c *Calendar) QueryCoarse(date time.Time) (DayType, error) + func (c *Calendar) QueryRange(start, end time.Time) ([]Dated, error) + func (c *Calendar) Stats(dates []time.Time, detailed bool) (StatsResult, error) + func (c *Calendar) StatsRange(start, end time.Time, detailed bool) (StatsResult, error) + type Dated struct + Date time.Time + Type DayType + type DayType uint8 + const DayTypeAdjustedRest + const DayTypeAdjustedWork + const DayTypeFestival + const DayTypeRest + const DayTypeUnknown + const DayTypeWork + func (t DayType) Adjustment() DayType + func (t DayType) Coarse() DayType + func (t DayType) IsAdjustedRestDay() bool + func (t DayType) IsAdjustedWorkDay() bool + func (t DayType) IsFestivalRest() bool + func (t DayType) IsRest() bool + func (t DayType) IsValid() bool + func (t DayType) IsWork() bool + func (t DayType) String() string + type Festival struct + Date time.Time + Name string + type StatsResult struct + Coarse map[DayType]int + Fine map[DayType]int + Total int + type Store struct + func LoadDir(dir string) (*Store, error) + func (s *Store) Get(year int) *YearConfig + func (s *Store) Has(year int) bool + func (s *Store) Years() []int + type YearConfig struct + Adjust Adjust + Festivals []Festival + Name string + Year int + func LoadYear(path string) (*YearConfig, error) + func (c *YearConfig) Validate() error